HTML / PHP显示特殊字符

时间:2014-07-15 11:06:44

标签: php html special-characters

我有以下示例PHP在输出中打印特殊字符。但它不打印任何特殊字符。

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
    <?php
    $string = "½ Kg";
    ?>

输出:

<p>� Kg</p>

我已经尝试了htmlspecialchars() or htmlentities(),这也是帮助!!

然后尝试在php中设置标头。

header('Content-Type: text/html; charset=utf-8');

它说,

  

警告:无法修改标头信息 - 已发送的标头

请建议如何打印特殊字符

0 个答案:

没有答案