html tags showing in content

My database contains data like:

&lt;b&gt;&lt;a href="[LINK]"&gt;You&lt;/a&gt;&lt;/b&gt; have a confirmed seat in the event &lt;b&gt;&lt;a href="[LINK]"&gt;[TITLE]&lt;/a&gt;&lt;/b&gt;<br>

when i display this it appears as:

<b> <a href="[LINK]">You</a></b> have a confirmed seat in the event <b><a href="[LINK]">[TIT

the text is broken and the html tags are also shown

i tried html_entity_decode()

Please help thankyou


只需使用htmlspecialchars_decode

htmlspecialchars_decode( '[...]', ENT_QUOTES );

Try using htmlspecialchars() while saving data to database and htmlspecialchars_decode() while displaying data to browser.
Hope this help you.

function cleanMyDirtyData( $dirty_dirty_data ){
return mysql_real_escape_string( htmlentities( $dirty_dirty_data, ENT_QUOTES,'UTF-8' ) );
}

在将数据写入数据库之前,请尝试使用此函数。

链接地址: http://www.djcxy.com/p/62054.html

上一篇: 单击链接时如何关闭Foundation的顶栏菜单?

下一篇: 在内容中显示的html标签