Browse Source

Merge pull request #1520 from nssprite/2.0

session_path在特定场景下存在问题
Jiang Qinghua 3 years ago
parent
commit
098dfa2edb
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/Http/Middleware/Session.php

+ 8 - 1
src/Http/Middleware/Session.php

@@ -12,7 +12,14 @@ class Session
             return $next($request);
         }
 
-        $path = '/'.trim(config('admin.route.prefix'), '/');
+        $path_prefix = '';
+        $path_arr = parse_url(config('app.url'));
+
+        if (array_key_exists('path', $path_arr) && !empty($path_arr['path'])) {
+            $path_prefix = rtrim($path_arr['path'], '/');
+        }
+
+        $path = $path_prefix . '/' . trim(config('admin.route.prefix'), '/');
 
         config(['session.path' => $path]);