Browse Source

修复一键生成文档在PHP5下的BUG
修复后台刷新导致的链接的错误

Karson 7 years ago
parent
commit
d2a523e462
2 changed files with 9 additions and 3 deletions
  1. 1 2
      application/admin/command/Addon.php
  2. 8 1
      application/common/controller/Backend.php

+ 1 - 2
application/admin/command/Addon.php

@@ -2,7 +2,6 @@
 
 namespace app\admin\command;
 
-use app\common\library\Menu;
 use think\addons\AddonException;
 use think\addons\Service;
 use think\Config;
@@ -67,7 +66,7 @@ class Addon extends Command
                 }
                 mkdir($addonDir);
                 mkdir($addonDir . DS . 'controller');
-                $menuList = Menu::export($name);
+                $menuList = \app\common\library\Menu::export($name);
                 $createMenu = $this->getCreateMenu($menuList);
                 $prefix = Config::get('database.prefix');
                 $createTableSql = '';

+ 8 - 1
application/common/controller/Backend.php

@@ -144,7 +144,14 @@ class Backend extends Controller
             $url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function($matches) {
                 return $matches[2] == '&' ? $matches[1] : '';
             }, $this->request->url());
-            $url = url($url, '', false);
+            if (Config::get('url_domain_deploy'))
+            {
+                if (stripos($url, $this->request->server('SCRIPT_NAME')) === 0)
+                {
+                    $url = substr($url, strlen($this->request->server('SCRIPT_NAME')));
+                }
+                $url = url($url, '', false);
+            }
             $this->redirect('index/index', [], 302, ['referer' => $url]);
             exit;
         }