mxi / mxcors
There is no license information available for the latest version (v1.0.1) of this package.
跨域
This package's canonical repository appears to be gone and the package has been frozen as a result.
v1.0.1
2021-03-03 13:48 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2025-04-10 09:19:39 UTC
README
安装和配置
修改项目下的composer.json文件,并添加:
composer require mxi/mxcors
在/path/to/config/app.php文件中,配置:
'cors' => array(
//域名白名单
'whitelist' => array(
//'http://xxx.xx.xxx',
//'http://xxx.xxx.xxx'
),
//header头
'headers' => array(
'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS', //支持的请求类型
'Access-Control-Allow-Credentials' => 'true' //支持cookie
)
)
然后执行`
composer update`
。
注册
在/path/to/config/di.php文件中,注册:
$di->cors = new \MxCORS\Inlet();