由于 PHP 文件管理功能,BOM 位于 doctype 之前
我已经在此处询问为什么我的页面 在 IE 中无法运行。答案是我在文档类型之前有一个字节。
但是,我检查并重新检查它,doctype之前没有空格,我将文档保存为ANSI,不带BOM的UTF-8(所有都带有记事本)并且它不会消失。
但是,我能够收集一些有趣的数据。我的网站用于显示内容模板。 如果我选择标题(问题所在)并直接在 IE 中显示它,它就可以工作!
所以我认为当从 php 读取文件并显示文件时会添加该位。 用于显示内容的 PHP 代码:
function gettemplate ($templatename) {
$filename = './templates/'. $templatename . ".tpl";
return ReadFromFile($filename);
}
文件的扩展名是 .tpl 但它的工作方式与 .html 完全相同(我已经检查过)
我怎样才能解决这个问题吗?
I have asked here why my page was not working in IE. The answer was that i had a byte just before the doctype.
However, i check it and re-check it, there is no a white space before doctype, i saved the document as ANSI, as UTF-8 without BOM (all of the with notepad) and it does not go away.
But, i was able to collect some interesting data. My website uses for displaying the content templates. If i select the header (where the problem is) and display it directly in IE, it works!
So i think the bit is added when the files are read from php and displayed.
PHP codes for displaying the content:
function gettemplate ($templatename) {
$filename = './templates/'. $templatename . ".tpl";
return ReadFromFile($filename);
}
The extension of the files is .tpl but it works exactly the same as if it was .html (i have checked it)
How can i solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我对您的页面进行十六进制转储时:
我看到两个 BOM 标记(两次 EF BB BF),这是不寻常的。您检查过 .php 文件本身是否有 BOM 标记吗?
When I do a hexdump of your Page:
I see two BOM-Markers (two times EF BB BF) which is unusual. Have you checked if the .php-files themselves have BOM-Markers?