Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Yii中的错误处理_Php_Yii_Error Handling - Fatal编程技术网

Php Yii中的错误处理

Php Yii中的错误处理,php,yii,error-handling,Php,Yii,Error Handling,我已经用Yii开发了一个web应用程序,但是我不能提供丰富的错误处理解决方案 这是我的密码 config/main.php 'components'=>array( 'errorHandler'=>array( // use 'site/error' action to display errors 'errorAction'=>'site/error', ), ), /* array( 'class'=>'CWeb

我已经用Yii开发了一个web应用程序,但是我不能提供丰富的错误处理解决方案

这是我的密码

config/main.php

'components'=>array(
   'errorHandler'=>array(
        // use 'site/error' action to display errors
        'errorAction'=>'site/error',
    ),
),
/* array(
    'class'=>'CWebLogRoute',
    'enabled'=>defined('YII_DEBUG'),
  ), */
站点控制器

public function actionError()
{

    if($error=Yii::app()->errorHandler->error)
    {
        if(Yii::app()->request->isAjaxRequest)
        {
            echo $error['message'];

        }
        else
            $this->render('error', array('error'=>$error));
    }
}
那就不行了

显示


我如何才能达到这个解决方案

这个问题自己解决了

如何解决这个问题

在内部accessRules函数上添加错误函数

和comment config/main.php

'components'=>array(
   'errorHandler'=>array(
        // use 'site/error' action to display errors
        'errorAction'=>'site/error',
    ),
),
/* array(
    'class'=>'CWebLogRoute',
    'enabled'=>defined('YII_DEBUG'),
  ), */
就这样


希望能帮助任何人

这个问题自己解决了

如何解决这个问题

在内部accessRules函数上添加错误函数

和comment config/main.php

'components'=>array(
   'errorHandler'=>array(
        // use 'site/error' action to display errors
        'errorAction'=>'site/error',
    ),
),
/* array(
    'class'=>'CWebLogRoute',
    'enabled'=>defined('YII_DEBUG'),
  ), */
就这样


希望帮助任何人

将错误重命名为error1并重试上述图像相同,但更改文本
系统无法找到请求的操作“error1”。
检查控制器的accessrule功能?您好,现在我正确显示错误页,但上面显示的错误页下面显示的错误页将错误重命名为error1并重试上述图像相同,但是更改文本
系统无法找到请求的操作“error1”。
检查控制器的accessrule功能?您好,现在我正确显示错误页面,但上面的错误显示在错误页面下面