包子

木森技术分享

路漫漫其修远兮,吾将上下而求索。

您现在的位置是:网站首页 > THINKPHP

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