PHP include() before doctype, causing a white space

前端 未结 5 1954
無奈伤痛
無奈伤痛 2021-01-20 13:37

I have a website with a white space problem. I am including a few files before the doctype and this is causing a white space to be outputted.

After searching I have

5条回答
  •  无人及你
    2021-01-20 14:16

    I figured it out. You have to encode "UTF-8 without BOM" for the file you are including.

    The master php file doesn't necessarily have to encode with "UTF-8 without BOM", and in fact I'd recommend that you don't if you have certain special characters (caused problems for me).

    Was also answered here: PHP include causes white space at the top of the page

提交回复
热议问题