PHP包含导致页面顶部出现空格的原因 [英] PHP include causes white space at the top of the page

查看:67
本文介绍了PHP包含导致页面顶部出现空格的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作的网站上有问题.我页面顶部有这行空白.我不知道它从哪里来.可能是由于php include()导致我页面中的额外换行符,或者仅仅是一些错误的CSS.

I have a problem on a site that I am making. There is this line of white space at the top of my page. I can not find out where it is coming from. It might be because of extra line breaks in my page thanks to php include() or maybe it is just some faulty css.

推荐答案

我明白了!我必须承认,这是一个非常奇怪的故事.

I got it! I must admit, this was a very strange one.

This was my exact problem, and his solution fixed it perfectly.


问题是由于include().


The problem was because of the include().

将页面另存为UTF-8时,文件的开头会包含一个称为字节顺序标记(或BOM)的特殊签名,表明它是UTF-8文件.您只能使用低级文本编辑器(例如 DOS修改).您需要从包含的文件中删除此签名,以便摆脱页面顶部的空白.

When you save a page as UTF-8, a special signature called a byte-order mark (or BOM) is included at the beginning of the file, indicating that it is a UTF-8 file. You can only see BOMs with low level text editors (such as DOS edit). You need to remove this signature from the included file in order to get rid of the white space at the top of the page.

这篇关于PHP包含导致页面顶部出现空格的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆