PHP_EOL常量使用

PHP_EOL常量是用来换行的,支持跨平台,在生成文件时,用来换行,或者在send mail时用到,在window 下相当于\r\n

 

 

PHP_EOL is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Mac/Unix issues.

 

 

 

You use PHP_EOL when you want a new line, and you want to be cross-platform.

This could be when you are writing files to the filesystem (logs, exports, other).

You could use it if you want your generated HTML to be readable. So you might follow your <br> with a PHP_EOL.

You would use it if you where running php as a script from cron and you needed to output something and have it be formated for a screen.

You might use it if you where building up anemail to send that needed some formatting.

你可能感兴趣的:(html,PHP,unix,dos,UP)