<?php
namespace app\h5\behavior;
class CORS
{
public function appInit(){
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:*');
header('Access-Control-Allow-Headers:x-requested-with,content-type');
}
}
Thinkphp5.0解决跨域问题在api模块新建behavior目录在behavior目录下边创建COSR.php类<?phpnamespace app\h5\behavior;class CORS{ public function appInit(){ header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Methods:*'); hea