euskadi31 / cors-service-provider
Silex 2.0 的 CORS 服务提供者
v1.0.2
2016-06-15 09:40 UTC
Requires
- silex/silex: ~2.0@dev
Requires (Dev)
- leaphub/phpcs-symfony2-standard: ~2.0.1
- phpunit/phpunit: ^4.7
This package is not auto-updated.
Last update: 2024-09-14 17:37:31 UTC
README
CorsServiceProvider 为您的 silex 2.0 应用程序提供作为中间件的 CORS 支持功能。CORS 允许您跨域进行 AJAX 请求。CORS 使用 OPTIONS 请求进行预检请求。由于 silex 默认没有处理 OPTIONS 请求的功能,因此此服务会遍历您的所有路由,并生成必要的 OPTIONS 路由。
安装
将 euskadi31/cors-service-provider
添加到您的 composer.json
% php composer.phar require euskadi31/cors-service-provider:~1.0
使用方法
配置
<?php $app = new Silex\Application; $app->register(new \Euskadi31\Silex\Provider\CorsServiceProvider);
许可证
CorsServiceProvider 采用MIT 许可证授权。