Home > Backend Development > PHP Tutorial > 请问PHP中的PHP_EOL为什么没有效果?

请问PHP中的PHP_EOL为什么没有效果?

WBOY
Release: 2016-06-23 14:22:09
Original
3328 people have browsed it

如下程序:

<?phpheader('Content-Type:text/html;charset=utf-8');function customError($errno, $errstr, $errfile, $errline) {	echo '<b>错误代码:</b>['.$errno.'] '.$errstr.PHP_EOL;	echo '错误所在的代码行:'.$errline.' 文件'.$errfile.PHP_EOL;	echo 'PHP版本:'.PHP_VERSION.'('.PHP_OS.')'.PHP_EOL;	die();}set_error_handler('customError', E_ALL|E_STRICT);$a = array('o' => 2, 4, 6, 8);echo $a[o];
Copy after login


输出:
错误代码:[8] Use of undefined constant o - assumed 'o' 错误所在的代码行:12 文件/usr/local/apache/htdocs/mytest/test2.php PHP版本:5.4.19(Linux) 

中间没有任何换行,为什么呢??

我的环境是centos


回复讨论(解决方案)

echo $a['o'];

换行是

PHP_EOL 是文本换行,不是 html 换行

原来如此,谢谢各位!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template