reverse htmlspecialchars

蓝咒 提交于 2019-11-27 21:50:57

Use htmlspecialchars_decode()

<?php
$str = "<p>this -&gt; &quot;</p>\n";

echo htmlspecialchars_decode($str);

// note that here the quotes aren't converted
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
?>

Reference - PHP Official Doc

You need htmlspecialchars_decode(). See PHP docu on this.

$html = htmlspecialchars_decode( $html, ENT_NOQUOTES );

example :

echo htmlspecialchars_decode(htmlspecialchars('your "strange" text with characters like !"/$%?&*'))

it will echo : your "strange" text with characters like !"/$%?&*

this is an example of encode/decode. it works.

hjpotter92

From what I understood, you need htmlspecialchars_decode - Docu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!