diff --git a/app/admin/route/.gitignore b/app/admin/route/.gitignore new file mode 100644 index 000000000..7e4a4bae7 --- /dev/null +++ b/app/admin/route/.gitignore @@ -0,0 +1 @@ +route.php \ No newline at end of file diff --git a/app/common.php b/app/common.php index fbde3444f..1fb81b8af 100755 --- a/app/common.php +++ b/app/common.php @@ -1486,13 +1486,13 @@ function MyUrl($path, $params = []) // 避免非当前目录生成url索引错误 if($script_name != 'index.php' && $is_index) { - // 替换索引为 index.php if($url_model == 0) { + // 替换索引为 index.php $url = str_replace($script_name, 'index.php', $url); } else { - // url模式!=兼容模式 则去除入口和?s= - $url = str_replace($script_name.'?s=', '', $url); + // 去除入口和?s= + $url = str_replace([$script_name.'?s=', '/'.$script_name], '', $url); } } // 替换索引为 api.php diff --git a/app/index/route/route.config b/app/route/route.config similarity index 100% rename from app/index/route/route.config rename to app/route/route.config diff --git a/app/service/ConfigService.php b/app/service/ConfigService.php index c28b1995d..3515f9e54 100755 --- a/app/service/ConfigService.php +++ b/app/service/ConfigService.php @@ -297,41 +297,48 @@ class ConfigService { if(isset($params['home_seo_url_model'])) { - $route_file = APP_PATH.'index'.DS.'route'.DS.'route.config'; - $route_file_php = APP_PATH.'index'.DS.'route'.DS.'route.php'; + $route_file = APP_PATH.'route'.DS.'route.config'; + $route_arr = ['admin', 'index']; - // 文件目录 - if(!is_writable(APP_PATH.'index'.DS.'route')) + // 后端+前端都生成对应的路由定义规则、为了后台进入前端url保持一致 + foreach($route_arr as $module) { - return DataReturn('路由目录没有操作权限'.'[./route]', -11); - } + // 生成路由文件 + $route_file_php = APP_PATH.$module.DS.'route'.DS.'route.php'; - // 路配置文件权限 - if(file_exists($route_file_php) && !is_writable($route_file_php)) - { - return DataReturn('路由配置文件没有操作权限'.'[./route/route.php]', -11); - } - - // pathinfo+短地址模式 - if($params['home_seo_url_model'] == 2) - { - - if(!file_exists($route_file)) + // 文件目录 + if(!is_writable(APP_PATH.$module.DS.'route')) { - return DataReturn('路由规则文件不存在'.'[./route/route.config]', -14); + return DataReturn('路由目录没有操作权限'.'[./app/'.$module.'/route]', -11); } - // 开始生成规则文件 - if(file_put_contents($route_file_php, file_get_contents($route_file)) === false) + // 路配置文件权限 + if(file_exists($route_file_php) && !is_writable($route_file_php)) { - return DataReturn('路由规则文件生成失败', -10); + return DataReturn('路由配置文件没有操作权限'.'[./app/'.$module.'/route/route.php]', -11); } - // 兼容模式+pathinfo模式 - } else { - if(file_exists($route_file_php) && @unlink($route_file_php) === false) + // pathinfo+短地址模式 + if($params['home_seo_url_model'] == 2) { - return DataReturn('路由规则处理失败', -10); + + if(!file_exists($route_file)) + { + return DataReturn('路由规则文件不存在'.'[./app/route/route.config]', -14); + } + + // 开始生成规则文件 + if(file_put_contents($route_file_php, file_get_contents($route_file)) === false) + { + return DataReturn('路由规则文件生成失败', -10); + } + + // 兼容模式+pathinfo模式 + } else { + if(file_exists($route_file_php) && @unlink($route_file_php) === false) + { + return DataReturn('路由规则处理失败', -10); + } } } return DataReturn('处理成功', 0); diff --git a/extend/base/Excel.php b/extend/base/Excel.php index 158d852db..d5de5c8c8 100755 --- a/extend/base/Excel.php +++ b/extend/base/Excel.php @@ -210,7 +210,7 @@ class Excel header('Expires: 0'); header('Cache-Control:must-revalidate, post-check=0, pre-check=0'); header('Content-Type:application/force-download'); - header('Content-Type: application/'.$this->file_type.';charset='.$charset); + header('Content-Type:application/'.$this->file_type.';charset='.$charset); header('Content-Type:application/octet-stream'); header('Content-Type:application/download'); header('Content-Disposition:attachment;filename='.$this->filename.'.'.$this->suffix); diff --git a/extend/base/Qrcode.php b/extend/base/Qrcode.php index ae2758720..5d4d7d014 100644 --- a/extend/base/Qrcode.php +++ b/extend/base/Qrcode.php @@ -206,6 +206,8 @@ class Qrcode header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-Type: application/octet-stream;charset=utf-8'); + header('Content-Type: application/download'); + header('Content-Type: application/force-download'); header('Content-Disposition: attachment; filename="'.$filename.'"'); header('Content-Transfer-Encoding: binary'); header('Connection: close'); diff --git a/tpl/think_exception.tpl b/tpl/think_exception.tpl deleted file mode 100644 index 519cc19ce..000000000 --- a/tpl/think_exception.tpl +++ /dev/null @@ -1,535 +0,0 @@ -'.end($names).''; - } -} - -if (!function_exists('parse_file')) { - function parse_file($file, $line) - { - return ''.basename($file)." line {$line}".''; - } -} - -if (!function_exists('parse_args')) { - function parse_args($args) - { - $result = []; - foreach ($args as $key => $item) { - switch (true) { - case is_object($item): - $value = sprintf('object(%s)', parse_class(get_class($item))); - break; - case is_array($item): - if (count($item) > 3) { - $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); - } else { - $value = sprintf('[%s]', parse_args($item)); - } - break; - case is_string($item): - if (strlen($item) > 20) { - $value = sprintf( - '\'%s...\'', - htmlentities($item), - htmlentities(substr($item, 0, 20)) - ); - } else { - $value = sprintf("'%s'", htmlentities($item)); - } - break; - case is_int($item): - case is_float($item): - $value = $item; - break; - case is_null($item): - $value = 'null'; - break; - case is_bool($item): - $value = '' . ($item ? 'true' : 'false') . ''; - break; - case is_resource($item): - $value = 'resource'; - break; - default: - $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); - break; - } - - $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; - } - - return implode(', ', $result); - } -} -if (!function_exists('echo_value')) { - function echo_value($val) - { - if (is_array($val) || is_object($val)) { - echo htmlentities(json_encode($val, JSON_PRETTY_PRINT)); - } elseif (is_bool($val)) { - echo $val ? 'true' : 'false'; - } elseif (is_scalar($val)) { - echo htmlentities($val); - } else { - echo 'Resource'; - } - } -} -?> - - - - - 系统发生错误 - - - - - - $trace) { ?> -
-
-
-
-

-
-

-
-
- -
-
    $value) { ?>
  1. ">
-
- -
-

Call Stack

-
    -
  1. - -
  2. - -
  3. - -
-
-
- - -
-

-
- - - -
-

Exception Datas

- $value) { ?> - - - - - - - $val) { ?> - - - - - - - -
empty
- -
- - - -
-

Environment Variables

- $value) { ?> - - - - - - - $val) { ?> - - - - - - - -
empty
- -
- - - - - - - - - - - - -