php 中 实体进行转换的函数 html_entity_decode()

htmlentities(); html_entity_decode(); htmlspecialchars();

 

            $a = '<div><p>11111#11</p></div> /s #1';
            $b = htmlentities($a);
            echo 'htmlentities: '.$b;
            echo "<br>";
            $c = html_entity_decode($b);
            echo 'html_entity_decode: '.$c;
            $d = htmlspecialchars($a);
            echo "htmlspecialchars: ".$d;

 

 

htmlentities: <div><p>11111#11</p></div> /s #1


html_entity_decode:
11111#11

/s #1


htmlspecialchars: <div><p>11111#11</p></div> /s #1

 

posted @ 2017-03-30 18:31  silvercell  阅读(1636)  评论(0)    收藏  举报