正確作法: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;