警予与重定向403

问题描述 投票:0回答:2

我使用Yii 1.1.17,并在我的行动,我有

$this->redirect(url('sell/default/index'), true, 403);

我得到的是一个空白页。甚至在日志中没有错误。但这个工程

$this->redirect(url('sell/default/index'));

问题是,我想设置一个403错误,所以我不上谷歌获得了软404错误。

我也试过this,但我仍然得到同样的结果。

有任何想法吗?

php yii google-webmaster-tools
2个回答
0
投票

如果你抛出一个异常...!

  throw new CHttpException(403,'Your Error message');

0
投票
  throw new HttpException(403, Yii::t('app', 'You are not allowed to perform this action.'));
© www.soinside.com 2019 - 2024. All rights reserved.