htmlentities()函数 中文转成乱码问题
作者:admin 日期:2019-04-25
关键词:htmlentities 乱码
htmlentities — Convert all applicable characters to HTML entities
string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = 'UTF-8' [, bool $double_encode = true ]]] )
对于中文如果不指定第三个参数的话,中文就被转成乱码,解决方法就是把第二、第三个参数(UTF-8或GBK)都指定了。
echo htmlentities("太原网站建设",ENT_NOQUOTES,GB2312)
echo htmlentities("太原网络公司",ENT_NOQUOTES,"utf-8")
广告位