yii2 beforecontrolleraction

    xiaoxiao2021-08-21  113

    在yii里面还有beforeControllerAction()这个函数,但是到了yii2里面就没了,但是不要着急,这个功能还在,改成了beforeAction()

    namespace app\modules\back; class Back extends \yii\base\Module { public $controllerNamespace = 'app\modules\back\controllers'; public function init() { parent::init(); // custom initialization code goes here //\Yii::$app->user->enableSession = false; } public function beforeAction($action) { if (!parent::beforeAction($action)) { return false; } // your custom code here return true; // or false to not run the action } }
    转载请注明原文地址: https://ju.6miu.com/read-676772.html

    最新回复(0)