first commit

This commit is contained in:
2026-05-07 16:37:25 +08:00
commit 822ed9a099
67 changed files with 1799 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
// app/middleware/Cors.php
declare(strict_types=1);
namespace app\admin\middleware;
class Cors
{
public function handle($request, \Closure $next)
{
// 设置CORS响应头
header('Access-Control-Allow-Origin: *'); // 允许的源
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS');
header('Access-Control-Allow-Headers: Authorization, Content-Type, X-Requested-With, X-CSRF-Token');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 1728000');
// 处理CORS预检请求
if ($request->isOptions()) {
return response()->code(200); // 预检请求,允许通过
}
return $next($request); // 继续处理请求
}
}