正确作法:web
Add this in the head section of your layout:this
<?= Html::csrfMetaTags() ?>spa
<?= Html::csrfMetaTags() ?>
不推荐的作法,如下作法是取消CSRF令牌验证:code
不推荐的作法,如下作法是取消CSRF令牌验证:
Add this in your controller:orm
Add this in your controller:
public $enableCsrfValidation = false;csrf
public $enableCsrfValidation = false;