作者 Karson

修复一键生成文档在PHP5下的BUG

修复后台刷新导致的链接的错误
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 namespace app\admin\command; 3 namespace app\admin\command;
4 4
5 -use app\common\library\Menu;  
6 use think\addons\AddonException; 5 use think\addons\AddonException;
7 use think\addons\Service; 6 use think\addons\Service;
8 use think\Config; 7 use think\Config;
@@ -67,7 +66,7 @@ class Addon extends Command @@ -67,7 +66,7 @@ class Addon extends Command
67 } 66 }
68 mkdir($addonDir); 67 mkdir($addonDir);
69 mkdir($addonDir . DS . 'controller'); 68 mkdir($addonDir . DS . 'controller');
70 - $menuList = Menu::export($name); 69 + $menuList = \app\common\library\Menu::export($name);
71 $createMenu = $this->getCreateMenu($menuList); 70 $createMenu = $this->getCreateMenu($menuList);
72 $prefix = Config::get('database.prefix'); 71 $prefix = Config::get('database.prefix');
73 $createTableSql = ''; 72 $createTableSql = '';
@@ -144,7 +144,14 @@ class Backend extends Controller @@ -144,7 +144,14 @@ class Backend extends Controller
144 $url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function($matches) { 144 $url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function($matches) {
145 return $matches[2] == '&' ? $matches[1] : ''; 145 return $matches[2] == '&' ? $matches[1] : '';
146 }, $this->request->url()); 146 }, $this->request->url());
147 - $url = url($url, '', false); 147 + if (Config::get('url_domain_deploy'))
  148 + {
  149 + if (stripos($url, $this->request->server('SCRIPT_NAME')) === 0)
  150 + {
  151 + $url = substr($url, strlen($this->request->server('SCRIPT_NAME')));
  152 + }
  153 + $url = url($url, '', false);
  154 + }
148 $this->redirect('index/index', [], 302, ['referer' => $url]); 155 $this->redirect('index/index', [], 302, ['referer' => $url]);
149 exit; 156 exit;
150 } 157 }