diff --git a/application/middleware.php b/application/middleware.php new file mode 100644 index 0000000..6c5a74c --- /dev/null +++ b/application/middleware.php @@ -0,0 +1,5 @@ +header('Origin'); - $Headers = $request->header('Access-Control-Request-Headers'); - header('Access-Control-Allow-Origin: ' . $Origin); - header('Access-Control-Allow-Headers: ' . $Headers); - header('Access-Control-Allow-Credentials:true'); - header('Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE'); - header('Access-Control-Max-Age: 1728000'); - header('Content-Type:text/plain charset=UTF-8'); - - if (strtoupper($request->method()) == "OPTIONS") { - header('HTTP/1.0 204 No Content'); - header('Content-Length:0'); - header('status:204'); - exit(); - } +// $Origin = $request->header('Origin'); +// $Headers = $request->header('Access-Control-Request-Headers'); +// header('Access-Control-Allow-Origin: ' . $Origin); +// header('Access-Control-Allow-Headers: ' . $Headers); +// header('Access-Control-Allow-Credentials:true'); +// header('Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE'); +// header('Access-Control-Max-Age: 1728000'); +// header('Content-Type:text/plain charset=UTF-8'); +// +// if (strtoupper($request->method()) == "OPTIONS") { +// header('HTTP/1.0 204 No Content'); +// header('Content-Length:0'); +// header('status:204'); +// exit(); +// } list($module, $controller, $action) = [$request->module(), $request->controller(), $request->action()]; $access = $this->buildAuth($node = NodeService::parseNodeStr("{$module}/{$controller}/{$action}")); $currentOrganizationCode = $request->header('organizationCode'); if ($currentOrganizationCode) { session('currentOrganizationCode', $currentOrganizationCode); } -// var_dump(session_id()); -// die; - // 登录状态检查 if (!empty($access['is_login']) && !session('member')) { $msg = ['code' => 401, 'msg' => '抱歉,您还没有登录获取访问权限!']; diff --git a/config/app.php b/config/app.php index dc97f11..a12e9e1 100644 --- a/config/app.php +++ b/config/app.php @@ -6,7 +6,7 @@ return [ // 应用名称 'app_name' => 'pearProject', // 应用版本 - 'app_version' => '2.0.0', + 'app_version' => '2.0.0', // 应用地址 'app_host' => '', // 应用调试模式