Wrong charset when using include_once('...')


Wrong charset when using include_once('...')

我已经配置了.htaccess文件以在.html文件中启用php。但是当我使用:

include_once('file.php');

在.html文件中,它包含 file.php但字符集错误 - 波兰字符未正确显示(黑色背景上的白色问号)。在我的 html 文件中,我有这个标题:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

而且我在体内使用include_once索姆...当我复制此php文件的内容而不是包含字符时,正确显示。在我的 php 文件中,我只有 html 代码,没有任何 php 函数......

怎么了?

您的.php文件未以 UTF-8 编码。在编辑器中打开它,并确保它保存为 UTF-8。