<!-- 公告消息提示(调用最新微语) -->
<?php global $CACHE; $nt = $CACHE->readCache('newtw'); ?>
<?php echo emoFormat($nt[0]['content']);?>(发表于<?php echo smartDate($nt[0]['date']);?>)
<?php exit;//a:3:{
i:0;a:7:{s:2:"id";s:1:"3";
s:7:"content";s:14:"我666[开心]";
s:3:"img";s:0:"";
s:6:"author";s:1:"2";
s:4:"date";s:10:"1437894786";
s:8:"replynum";s:1:"0";
s:1:"t";s:14:"我666";}
i:1;a:7:{s
:2:"id";s:1:"2";
s:7:"content";s:33:"[呵呵][吃惊][偷笑]不错噢";
s:3:"img";s:0:"";
s:6:"author";s:1:"1";
s:4:"date";s:10:"1437890392";
s:8:"replynum";s:1:"0";
s:1:"t";s:290:"<img title="[呵呵]" src="http://xiaows.com/x/admin/editor/plugins/emoticons/images/1.gif"/><img title="[吃惊]" src="http://xiaows.com/x/admin/editor/plugins/emoticons/images/14.gif"/><img title="[偷笑]" src="http://xiaows.com/x/admin/editor/plugins/emoticons/images/25.gif"/>不错噢";
}
i:2;a:7:{
s:2:"id";s:1:"1";
s:7:"content";s:39:"使用微语记录您身边的新鲜事";
s:3:"img";s:0:"";
s:6:"author";s:1:"1";
s:4:"date";s:10:"1437797327";
s:8:"replynum";s:1:"0";
s:1:"t";s:39:"使用微语记录您身边的新鲜事";
}}
/**
* 替换表情
*
* @param $t
*/
function emoFormat($t){
$emos = array('[耶]'=>'0.gif', '[呵呵]'=>'1.gif', '[悲伤]'=>'2.gif', '[抓狂]'=>'3.gif', '[衰]'=>'4.gif', '[花心]'=>'5.gif', '[哼]'=>'6.gif', '[泪]'=>'7.gif', '[害羞]'=>'8.gif', '[酷]'=>'9.gif', '[晕]'=>'10.gif', '[挤眼]'=>'11.gif', '[鬼脸]'=>'12.gif', '[汗]'=>'13.gif', '[吃惊]'=>'14.gif', '[发呆]'=>'15.gif', '[闭嘴]'=>'16.gif', '[撇嘴]'=>'17.gif', '[疑问]'=>'18.gif', '[睡觉]'=>'19.gif', '[NO]'=>'20.gif', '[大哭]'=>'21.gif', '[爱你]'=>'22.gif', '[嘻嘻]'=>'23.gif', '[生病]'=>'24.gif', '[偷笑]'=>'25.gif', '[思考]'=>'26.gif', '[玫瑰]'=>'27.gif', '[心]'=>'28.gif', '[伤心]'=>'29.gif', '[咖啡]'=>'30.gif', '[音乐]'=>'31.gif', '[下雨]'=>'32.gif', '[晴天]'=>'33.gif', '[星星]'=>'34.gif', '[月亮]'=>'35.gif');
if(!empty($t) && preg_match_all('/\[.+?\]/',$t,$matches)){
$matches = array_unique($matches[0]);
foreach ($matches as $data) {
if(isset($emos[$data]))
$t = str_replace($data,'<img title="'.$data.'" src="'.BLOG_URL.'admin/editor/plugins/emoticons/images/'.$emos[$data].'"/>',$t);
}
}
return $t;
}
$user_cache = $CACHE->readCache('user'); echo $user_cache[$nt[0]['author']]['name'];
<!-- 公告消息提示(调用最新微语) -->
<?php global $CACHE; $nt = $CACHE->readCache('newtw'); ?>
<?php echo emoFormat($nt[0]['content']);?>(<?php $user_cache = $CACHE->readCache('user'); echo $user_cache[$nt[0]['author']]['name'];?>发表于<?php echo smartDate($nt[0]['date']);?>)
感谢作者:笑忘书的投稿,欢迎大家投稿: https://www.blogs.hk/post-87.html
留言咨询