如何正确显示$ string_result
中显示的$ string$string = "À";
$string = html_entity_decode($string); //output as À
$string_result = "À";
echo "<br>This: " . $string;
echo "<br>Should become: " . ($string_result);
输出
This: À
Should become: À
如果我在代码($ string_result)中硬编码,显示是正确的,但如果它是在变量($ string)中分配的,则它不会显示与$ string_result相同。
奇怪的是当我这样做时:
echo htmlentities($string);
echo htmlentities($string_result);
输出就像这样
À
À
答案 0 :(得分:0)
添加标题:
header('Content-Type: text/html; charset=utf-8');
在代码的开头。