I am posting this content in the Editor.
> <div class="faq"><ul><li><span class="q">What is a teest?</span>
> <span class="a">A test.</span><div class="spacer"></div></li> </ul></div>
It is saving in the following format.
<p><div class=\\\"faq\\\"><ul><li><span class=\\\"q\\\">What is a teest?</span> <br /><s开发者_开发技巧pan class=\\\"a\\\">A test.</span><div class=\\\"spacer\\\"></div></li> </ul></div></p>
So the output is not showing perfectly. I have added stripslashes and addslashes. Even it doesn't work.
What is the best way to resolve this issue?
Thanks in advance...
That's ugly..
You need stripslashes()
twice, strip_tags()
and htmlspecialchars_decode()
, if you want working HTML code.
$html = '<p><div class=\\\"faq\\\"><ul><li><span> ...';
$html = htmlspecialchars_decode(strip_tags(stripslashes(stripslashes( $html ))));
echo $html;
This will print:
<div class="faq"><ul><li><span class="q">What is a teest?</span> ...
精彩评论