給出下面的腳本爲什麼當'display_errors'打開時,此語法錯誤返回HTTP錯誤500?
<?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總是顯示錯誤?
有更多的代碼? –
是的,嘗試發佈所有標籤。可能是影響結果並且看不見的東西。到目前爲止 - 沒有其他的想法:/ –
第一個代碼示例是否真的說「thisisanerror」還是隻是說「錯誤」?錯誤消息提示後者。 – octern