开发者

php include or require echos for no reason

i'm working on a website. I have a file in php and I want to include it. The file contains a big array, nothing else.

When I tried to include it, the page functioned normally 开发者_Go百科but I needed to convert my included file from ANSI to UTF8. After converting (notepad++) i get a big space at the top of the screen. Using firebug I was able to figure out that when I include the UTF8 encoded version of the file, it echos break lines... As you would assume, that is the kind of behaviour i did not expect. How to convert the file so that it does not echo itself for no reason?


Try to convert it to UTF-8 without BOM.

Make sure your file looks like this (there is nothing before <?php):

<?php
    $array=array(
         /* elements */
    );


put the

 <?php

open tag at the very beginning of the file.


And do not include a ?> tag at the end of your file, if it only contains PHP code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜