PHP code example of ajiho / think-cors

1. Go to this page and download the library: Download ajiho/think-cors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ajiho / think-cors example snippets



return [

    //允许的域名
    'allow_origin' => [
        '*'
    ],

    //允许的请求头
    "allow_headers" => [
        'Origin',
        'X-Requested-With',
        'Content-Type',
        'Accept',
        'Authorization',
        'Cache-Control'
    ],

    //允许的方法
    "allow_methods" => [
        'GET',
        'POST',
        'PUT',
        'DELETE',
        'OPTIONS',
        'PATCH'
    ]
];

\ajiho\middleware\Cors::class