Yii:同一路线,但只有在确认后才能获得工程';没有控制器过滤器
我的urlManager规则:(基本上是默认的) 我的看法是:Yii:同一路线,但只有在确认后才能获得工程';没有控制器过滤器,yii,Yii,我的urlManager规则:(基本上是默认的) 我的看法是: <form method="POST" action="<?php echo $this->createUrl('site/subscribe'); ?>" style="display: inline;"> <input style="margin: 0 18px 0 6px;" type="text" value="e-mail"/> </form> “当我使用ur
<form method="POST" action="<?php echo $this->createUrl('site/subscribe'); ?>" style="display: inline;">
<input style="margin: 0 18px 0 6px;" type="text" value="e-mail"/>
</form>
“当我使用url http://*/site/subscribe直接访问它时,它会工作”
=>使用GET方法执行subscribe
操作
“但是,当我在文本字段中键入内容并按下enter按钮发布表单时,系统会显示无法找到请求的操作“错误”。”
=>使用POST方法执行subscribe
操作
=>存在一些错误,我想我会尝试使用默认配置来处理错误:
return array(
......
'components'=>array(
'errorHandler'=>array(
'errorAction'=>'site/error',
),
),
);
但是,我无法使用站点控制器找到错误
操作,因此它抛出系统无法找到请求的操作“错误”。
您可以添加错误
操作以查看有关错误的信息,如:
public function actionError()
{
if($error=Yii::app()->errorHandler->error){
$this->render('error', $error);
}
}
更多信息:上述错误
变量是一个包含以下字段的数组:
code: the HTTP status code (e.g. 403, 500);
type: the error type (e.g. CHttpException, PHP Error);
message: the error message;
file: the name of the PHP script file where the error occurs;
line: the line number of the code where the error occurs;
trace: the call stack of the error;
source: the context source code where the error occurs.
非常感谢你。错误消息说,无法验证CSRF令牌。
。
public function actionError()
{
if($error=Yii::app()->errorHandler->error){
$this->render('error', $error);
}
}
code: the HTTP status code (e.g. 403, 500);
type: the error type (e.g. CHttpException, PHP Error);
message: the error message;
file: the name of the PHP script file where the error occurs;
line: the line number of the code where the error occurs;
trace: the call stack of the error;
source: the context source code where the error occurs.