$string = "Główny folder grafik<p>asd nc</p>";
echo htmlspecialchars($string);
on live sitephp - 带unicode的htmlspecialchars
Główny folder grafik<p>asd nc</p>
on local
Główny folder grafik<p>asd nc</p>
有什么问题?我希望在实时网站上运行结果看起来像本地
$string = "Główny folder grafik<p>asd nc</p>";
echo htmlspecialchars($string);
on live sitephp - 带unicode的htmlspecialchars
Główny folder grafik<p>asd nc</p>
on local
Główny folder grafik<p>asd nc</p>
有什么问题?我希望在实时网站上运行结果看起来像本地
htmlspecialchars()
接受附加参数 - 第三个是字符集。
尝试指定第三个参数。
您可能需要将可选参数传递给htmlspecialchars,默认情况下,字符集是ISO-8859-1。
您需要为htmlspecialchars()函数添加额外的参数。以下应该工作:
htmlspecialchars($string, ENT_QUOTES, "UTF-8");
为什么你需要做到这一点呢?这不应该是必要的。 – 2011-04-04 10:38:58