表情符号放在评论的开头

时间:2013-02-06 13:55:19

标签: php emoticons

我正在使用一个函数在我的个人书面博客评论中显示表情符号。

function emoticons($text) {
$emoticons = array(
'<img src="http://www.example.com/images/smileys/smile.png" alt="emoticon" />' => array('1' => ':-)', '2' => ':)'),
'<img src="http://www.example.com/images/smileys/wink.png" alt="emoticon" />' => array('1' => ';-)', '2' => ';)'),
'<img src="http://www.example.com/images/smileys/cool.gif" alt="emoticon" />' => array('1' => '8)', '2' => '8|')
);
foreach ($emoticons as $key => $emoticon) {
$text = str_replace($emoticon, $key, $text);
}
return $text;
}

用户一旦用笑脸代码发表评论,例如

谢谢Sammry:)

我的表情符号出现在开头但不在用户使用过的地方,就像这样

(表情图片)谢谢你Sammry

我应该怎么做才能确保用户使用笑脸代码而不是在评论开头显示。

非常感谢帮助,提前致谢

0 个答案:

没有答案
相关问题