开发者

Line breaks outside <?php tags

My web host's PHP engine is taking everything outside <?php ?> and replacing line breaks with <br>, like so:

<?php

echo 'php1';

?>

Hello
world

<?php
echo 'php2';
?>

The output开发者_如何学编程 I get is:

php1
<br><br>Hello<br>world<br><br>php2

All of the other servers I use do this, which is what I want:

php1

Hello
world

php2

Can I disable this behaviour?


As far as I can tell, there is no PHP .ini directive to do this.

Contact your webhost and ask them about it, but I suspect that something else is up here.


Try setting the header to Content-Type: text/plain and see if that helps

<?php
header('Content-Type: text/plain');
?>


Try this, your host is very wierd

<?php
    echo 'php1';
?>
Hello
world
<?php
   echo 'php2';
?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜