2.0用的参数是_csrf
token = "<?php echo \Yii::$app->request->getCsrfToken()?>",
$.ajax({
type:"post",
url:"http://XXX.XXX.XXX/basic/web/index.php?r=admin/publish",
data:{_csrf: token},
dataType:"json",
success: function(data) {
console.log(data);
},
error:function() {
console.log(321)
}
})
来源:oschina
链接:https://my.oschina.net/u/4306387/blog/3876260