WYSIWYG前端显示为HTML

时间:2014-03-16 02:42:38

标签: php html wysiwyg

我有一个使用

添加到数据库中的HTML WYSIWYG

'page_description' => htmlspecialchars($this->input->post('content'));

当我在前端查看时,我得到enter image description here

如何对其进行解码,使其显示为HTML?

2 个答案:

答案 0 :(得分:2)

删除htmlspecialchars位。这会将<转换为&lt;,因此会将其打印为实际符号,并被浏览器忽略为HTML标记的开头。

'page_description' => $this->input->post('content');

来自:http://us2.php.net/htmlspecialchars

The translations performed are:

'&' (ampersand) becomes '&amp;'
'"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set.
"'" (single quote) becomes '&#039;' (or &apos;) only when ENT_QUOTES is set.
'<' (less than) becomes '&lt;'
'>' (greater than) becomes '&gt;'

答案 1 :(得分:1)

PHP中与htmlspecialchars / htmlentities相反的函数是html_entity_decode