响应头加上以下代码
public function init() { header("Origin:http://vue.***.com"); header("Access-Control-Allow-Origin:http://vue.***.com"); header("Access-Control-Request-Headers:http://vue.***.com"); header("Access-Control-Allow-Credentials:true"); header("Access-Control-Allow-Headers: Content-Type, X-Requested-With, Cache-Control,Authorization"); parent::init(); // custom initialization code goes here }