$a = $_GET['t'];var_dump($a);echo "then.......<hr />";$b = htmlspecialchars($a);var_dump($b);
http://localhost/test.php?t=中文字符
输出如下:
string(8)”中文字符”then…….
string(0)””
回复内容:
$a = $_GET['t'];var_dump($a);echo "then.......<hr />";$b = htmlspecialchars($a);var_dump($b);
http://localhost/test.php?t=中文字符
输出如下:
string(8)”中文字符”then…….
string(0)””
@本文来源gaodaimacom搞#代%码@网-搞代gaodaima码
htmlspecialchars 的第三个参数是encoding
<code>$b = htmlspecialchars($a,ENT_QUOTES,'UTF-8');</code>
这样应该就没问题了