PHP 跨域资源共享中间件 PHP CORS

码农软件 · 软件分类 · 网络工具包 · 2019-02-24 18:41:25

软件介绍

CORS

这是一个 PHP 跨域资源共享 (CORS Cross-origin resource sharing) 中间件。

支持

  • Array, 原生 PHP 代码

  • 使用 PSR-7

  • Laravel

  • Symfony

使用

composer require medz/cors

示例

use Medz\Cors\Cors;

$cors = new Cors($config); // The $config -> `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 都是单独设置支持的类型,但如果在框架中使用,这两个值通常是相同的。因为你可以单独设置它,所以你可以根据自己的需要提供不同的值以实现你的目标。

本文地址:https://www.codercto.com/soft/d/51.html

Learn Python 3 the Hard Way

Learn Python 3 the Hard Way

Zed A. Shaw / Addison / 2017-7-7 / USD 30.74

You Will Learn Python 3! Zed Shaw has perfected the world’s best system for learning Python 3. Follow it and you will succeed—just like the millions of beginners Zed has taught to date! You bring t......一起来看看 《Learn Python 3 the Hard Way》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具