ThinkPHP8.0+ 跨域问题解决方案
参考地址:https://www.thinkphp.cn/ext/121
首先安装扩展包:composer require topthink/think-cors
配置文件  config/cors.php
配置参考:
<?php
return [
    'paths'                    => ['*'],
    'allowed_origins'          => ['*'],
    // 'allowed_origins' => ['http://localhost:3000'], // 指定允许的源
    'allowed_origins_patterns' => [],
    'allowed_methods'          => ['*'],
    'allowed_headers'          => ['*'],
    'exposed_headers'          => [],
    'max_age'                  => 0,
    'supports_credentials'     => false,
];
 
             
             
             
             
            