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

修复后台刷新导致的链接的错误
pull/48/head
Karson 2018-03-08 22:29:29 +08:00
parent d863f93d10
commit d2a523e462
2 changed files with 9 additions and 3 deletions

View File

@ -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 = '';

View File

@ -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;
}