Home> PHP Framework> YII> body text

What should I do if the yii2 project Action reports a 403 error?

藏色散人
Release: 2020-07-20 10:00:04
Original
3008 people have browsed it

The solution to the 403 error reported by the yii2 project: first open the corresponding code file; then modify the writing method in the ACF verification; finally, separate the words with "-" symbols to solve the 403 error.

What should I do if the yii2 project Action reports a 403 error?

##yii2.0 Action reports 403 error [2.0 version]

When you are editing an action, Maybe it's a word, maybe it's a spliced word, such as actionGet(); actionSpecialCallback();

Recommended: "

yii tutorial"

When you meet actionSpecialCallback() ; When using this method, the way you write in ACF verification is to use - to separate words between words, and there will be no 403 error, as shown below:

use yii\filters\AccessControl; class SiteController extends Controller { public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['special-callback'], 'rules' => [ [ 'actions' => ['special-callback'], 'allow' => true, 'matchCallback' => function ($rule, $action) { return date('d-m') === '31-10'; } ], ], ], ]; } // Match callback called! This page can be accessed only each October 31st public function actionSpecialCallback() { return $this->render('happy-halloween'); } }
Copy after login

The above is the detailed content of What should I do if the yii2 project Action reports a 403 error?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!