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 关注
- 885 浏览
添加回答
举报
0/150
提交
取消