The function that is intended in PHP to be a sort of inverse to htmlspecialchars
/htmlentities
is html_entity_decode.
WYSIWYG frontend display as HTML
質問
I have an HTML WYSIWYG that is added into the db using
'page_description' => htmlspecialchars($this->input->post('content'));
When I view on the frontend I get
How can I decode it so it shows as HTML?
解決
他のヒント
Remove the htmlspecialchars
bit. That's converting <
into <
so it prints out as the actual symbol, ignored by the browser as the start of an HTML tag.
'page_description' => $this->input->post('content');
From: 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 '>'
所属していません StackOverflow