2016-12-16 07:58:02 0 评论 Yii 2.0 Boy.Lee

Yii 2.0 针对特定 action关闭CSRF验证

/**
 * @inheritdoc
 */
public function beforeAction($action)
{            
    if ($action->id == 'yiilib-method') {
        $this->enableCsrfValidation = false;
    }

    return parent::beforeAction($action);
}