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.
##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'); } }
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!