I am saving some content to mysql using TinyMCE, and it stores correctly with all formatting (HTML code) in database.
<p> <strong>TEST</strong></p>
<h1>TEst</h1>
However while echo, I am loosing the formatting. I want to know how to display the content with all formatting.
You can use pre
tag like
echo '<pre>Whatever your text</pre>'
The HTML <pre>
element represents preformatted text which is to be presented exactly as written in the HTML file. Whitespace etc inside this element is displayed as written
Try to use
html_entity_decode($string, ENT_QUOTES, 'UTF-8');
where $string
is your formatted string
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.