开发者

PHP - Strip Tags allow "<3" text hearts

Hey Guys,开发者_Python百科 I usually come to StackOverflow for my php coding answers, although this time I could not seem to find one.

I am creating a social networking type website that requires lots of text entering and data checking. Everything seems good and the other day I was testing some characters users may enter and its seems that if I try to insert a '<3' it says its empty.

<?php
$text = "<3";
$clean = strip_tags($text);
echo $clean; // prints out nothing..
?>


Use htmlspecialchars instead strip_tags.


"<3" will be break your HTML when you output it directly.

May you replace it with an (Heart)Image or other HTML- Tag( with css heart property) , like you would do with Smileys.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜