我一直在尝试在评论中添加表情符号,但它不起作用,我不知道为什么。
Parse error: syntax error, unexpected T_STRING in /home/content/---------------------------/cdn/postdisplay.php on line 1
我包含并加载以显示评论的完整 php。
<?php
function smiliess($text) {
$smilies = array(
'>:(' => '<img src="image/icon/angry.png" alt="angry" class="icon_smile1" />',
'(angry)' => '<img src="image/icon/angry.png" alt="angry" class="icon_smile2" />',
'(Angry)' => '<img src="image/icon/angry.png" alt="angry" class="icon_smile3" />',
'(ANGRY)' => '<img src="image/icon/angry.png" alt="angry" class="icon_smile4" />',
'B|' => '<img src="image/icon/cool.png" alt="cool" class="icon_smile5" />',
'(cool)' => '<img src="image/icon/cool.png" alt="cool" class="icon_smile6" />',
'(Cool)' => '<img src="image/icon/cool.png" alt="cool" class="icon_smile7" />',
'(COOL)' => '<img src="image/icon/cool.png" alt="cool" class="icon_smile8" />',
// more smiley
);
foreach ($smilies as $search => $replace)
$text = preg_replace("#(?<=\s|^)" . preg_quote($search) . "#", $replace, $text);
return $text;
}
$CheckQuery = mysql_query("SELECT * FROM t_comment WHERE got='$user->id' ORDER BY `id` DESC LIMIT 0 , 20");
while($row = mysql_fetch_assoc($CheckQuery))
{
$toolsp = new UserTools();
$post = $toolsp->get($row['send_id']);
$yourText = $row['content'];
$yourdisplay = smiliess( $yourText );
echo '<div class="mycomment">
<div id="postpic">
<img id="profile_pic" width="50px" height="150px" src="' . $post->image . '" class="" />
</div>
<div class="mycommentpost">
<a class="postername" href="profile.php?userID=' . $post->id . '">' . $post->fname . ' ' . $post->lname . ': </a><br />
' . $yourdisplay . '
</div>
</div>';
}
?>
当我从 php 中删除表情符号代码时,它工作正常。