php 轉義html標簽 反轉html標簽 符號


$a = '<strong>123</strong>';     //假設這是html代碼
$b =  htmlspecialchars($a);          //將< >這些符號轉為&lt;等等
echo htmlspecialchars_decode($b);     //這個是htmlspecialchars函數的反函數
// echo html_entity_decode($a);        //這個也是htmlspecialchars的反函數

 

//兩個反函數之間的區別自行搜索吧

//應該是轉義的范圍不一樣吧

 

htmlspecialchars

htmlspecialchars_decode

 

 

htmlentities

html_entity_decode

這幾個自己研究吧,我就是簡單記錄一下有這么幾個函數


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM