是否有一个php.ini指令,可以在错误上启用堆栈跟踪?我已经看过这里:http://php.net/manual/en/ini.core.php.我的共享托管由于某种原因没有安装Xdebug.我尝试将它们放在.htaccess中:
php_value track_erors On
php_value report_zend_debug 1
Run Code Online (Sandbox Code Playgroud)
但没有堆栈跟踪.
有debug_backtrace.但这不会对致命错误起作用,因为那些无法处理.
例:
<?php
function exceptions_error_handler($severity, $message, $filename, $lineno) {
var_dump(debug_backtrace());
}
set_error_handler('exceptions_error_handler');
function c() {
echo $a;
}
c();
Run Code Online (Sandbox Code Playgroud)
得到:
array
0 =>
array
'file' => string '/tmp/cpu7HL5A' (length=13)
'line' => int 9
'function' => string 'exceptions_error_handler' (length=24)
'args' =>
array
0 => &int 8
1 => &string 'Undefined variable: a' (length=21)
2 => &string '/tmp/cpu7HL5A' (length=13)
3 => &int 9
4 => &
array
empty
1 =>
array
'file' => string '/tmp/cpu7HL5A' (length=13)
'line' => int 12
'function' => string 'c' (length=1)
'args' =>
array
empty
| 归档时间: |
|
| 查看次数: |
10724 次 |
| 最近记录: |