为了账号安全,请及时绑定邮箱和手机立即绑定

PHP怎么把字符串里变成转义字符

PHP怎么把字符串里变成转义字符

PHP
偶然的你 2018-07-11 10:10:41
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);

查看完整回答
反对 回复 2018-08-20
  • 1 回答
  • 0 关注
  • 862 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信