Den*_*gin 1 php error-handling yii
不能让Yii向webbrowser显示错误.在配置的自定义错误处理程序配置:
'errorHandler' => array(
// use 'site/error' action to display errors
'errorAction' => 'site/error',
),
Run Code Online (Sandbox Code Playgroud)
但所有错误只写入application.log,然后Apache服务器空页写入错误500.如何在屏幕上显示Yii打印错误?
index.php:
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
Run Code Online (Sandbox Code Playgroud)
你应该稍微修改你的config/main.php.有一个项目errorHandler.它应该如下所示:
'errorHandler' => [
// use 'site/error' action to display errors
'errorAction' => YII_DEBUG ? null : 'site/error',
],
Run Code Online (Sandbox Code Playgroud)
这是因为优先级提高了CErrorHandler::$errorAction.以下是讨论:https://github.com/yiisoft/yii/issues/3760
| 归档时间: |
|
| 查看次数: |
10199 次 |
| 最近记录: |