改进View类的root获取

This commit is contained in:
thinkphp
2016-12-09 15:29:22 +08:00
parent 08f648966c
commit a223dd5aff

View File

@@ -40,9 +40,9 @@ class View
// 基础替换字符串
$request = Request::instance();
$base = $request->root();
$root = strpos($base, '.') ? ltrim(dirname($base), '\\') : $base;
$root = strpos($base, '.') ? ltrim(dirname($base), DS) : $base;
if ('' != $root) {
$root = '/' . $root;
$root = '/' . ltrim($root, '/');
}
$baseReplace = [
'__ROOT__' => $root,