我有一个使用
添加到数据库中的HTML WYSIWYG 'page_description' => htmlspecialchars($this->input->post('content'));
当我在前端查看时,我得到
如何对其进行解码,使其显示为HTML?
答案 0 :(得分:2)
删除htmlspecialchars
位。这会将<
转换为<
,因此会将其打印为实际符号,并被浏览器忽略为HTML标记的开头。
'page_description' => $this->input->post('content');
来自:http://us2.php.net/htmlspecialchars
The translations performed are:
'&' (ampersand) becomes '&'
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
"'" (single quote) becomes ''' (or ') only when ENT_QUOTES is set.
'<' (less than) becomes '<'
'>' (greater than) becomes '>'
答案 1 :(得分:1)
PHP中与htmlspecialchars
/ htmlentities
相反的函数是html_entity_decode。