/**
* 转换特殊字符为HTML实体字符
*
* @param string $string
* @param boolean $doubleEncode
* @return string
*/
function htmlEncode($string, $doubleEncode = true)
{
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
$reVal = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', $doubleEncode);
} else {
$reVal = htmlspecialchars($string, ENT_QUOTES, 'UTF-8', $doubleEncode);
}
return $reVal;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询