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)
}
})