CORS
PHP CORS(跨域资源共享)中间件。
支持
Symfony支持
Yii2支持
使用
composer require medz/cors
例:
use Medz \ Cors \ Cors ;
$ cors = new Cors ( $ config ); // The $config :backhand_index_pointing_right: `config/cors.php` file.
$ cors -> setRequest ( $ requestType , $ request ); // The $request is empty array or is `NULL` or $_REQUEST
$ cors -> setResponse ( $ responseType , $ response ); // The $response is empty array.
$ cors -> handle ();
$ response = $ cors -> getResponse ();
$requestType和$responseType都是
1