2011-04-04 38 views
2
 $string = "Główny folder grafik<p>asd nc</p>"; 

echo htmlspecialchars($string); 

on live sitephp - 带unicode的htmlspecialchars

G&#322;ówny folder grafik<p>asd nc</p> 

on local

Główny folder grafik<p>asd nc</p> 

有什么问题?我希望在实时网站上运行结果看起来像本地

+0

为什么你需要做到这一点呢?这不应该是必要的。 – 2011-04-04 10:38:58

回答

1

htmlspecialchars()接受附加参数 - 第三个是字符集。

尝试指定第三个参数。

1

您需要为htmlspecialchars()函数添加额外的参数。以下应该工作:

htmlspecialchars($string, ENT_QUOTES, "UTF-8");