给出以下脚本
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
thisisanerror
?>
我得到了预期
Notice: Use of undefined constant error - assumed 'error' in /htdocs/test.php on line 8
但是如果我在脚本中添加一些东西
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
error
function test () {
echo('test');
}
?>
我明白了
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
为什么在后一种情况下我收到 500 错误而不是正常的语法错误?display_errors 不应该总是显示错误吗?