You are here: Re: extra newlines in output text added by PHP file include « PHP Programming Language « IT news, forums, messages
Re: extra newlines in output text added by PHP file include

Posted by Andy Hassall on 11/12/06 18:17

On 12 Nov 2006 05:39:25 -0800, abrtlt@yahoo.com wrote:

>I have a simple PHP script that outputs a string requested by an Ajax
>page. XMLHttpRequestObject.responseText as received from the PHP script
>begins with 2 extra newline characters (\n\nMyString):
>
><?php
>require_once('DB.php');

There's probably one at the start or end of DB.php.

>require_once('../myDir/myFile.php');

There's probably one at the start or end of this one too, which would make two
newlines.

If the included PHP file ends in a new line immediately after the closing ?>,
then it won't be sent. This is recommended else tools such as diff get upset.

If there's an additional blank line after that, then that will get sent.

Also be careful with the difference between Windows line endings and UNIX line
endings, as that can confuse the issue.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация