PHP怎么把字符串里變成轉義字符
1 回答

萬千封印
TA貢獻1891條經驗 獲得超3個贊
編碼
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; // <a href='test'>Test</a>
解碼
$str = '<p>this -> "</p>';
echo htmlspecialchars_decode($str);
// note that here the quotes aren't converted
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
- 1 回答
- 0 關注
- 908 瀏覽
添加回答
舉報
0/150
提交
取消