thinkphp html标签转义/反转义
2024-03-22 18:34:01438
1.htmlentities()函数:
说明:将html标签转换成特殊字符。例如将<script>转换成"<script>"
2.html_entity_decode()函数
说明:将htmlentities()函数转义过的字符串转成html标签。
$orig = "I'll /"walk/" the <b>dog</b> now"; $a = htmlentities($orig); $b = html_entity_decode($a); echo $a; // I will "walk" the <b>dog</b> now echo $b; // I will "walk" the <b>dog</b> now