构造方法写一下代码 public function __construct(Request $request = null)
//跨域
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
if (request()->isOptions()) { //浏览器的option试探请求,要exit掉,不然你的业务会被执行两次
exit();
}