内核更新

This commit is contained in:
2016-08-06 15:06:11 +08:00
parent 9f5c4070cc
commit fed3a1d215
11 changed files with 229 additions and 60 deletions
+12 -2
View File
@@ -19,6 +19,9 @@ use think\Route;
class Url
{
// 生成URL地址的root
protected static $root;
/**
* URL生成 支持路由反射
* @param string $url URL表达式,
@@ -129,7 +132,7 @@ class Url
// 检测域名
$domain = self::parseDomain($url, $domain);
// URL组装
$url = $domain . Request::instance()->root() . '/' . ltrim($url, '/');
$url = $domain . (self::$root ?: Request::instance()->root()) . '/' . ltrim($url, '/');
return $url;
}
@@ -354,4 +357,11 @@ class Url
{
Cache::rm('think_route_map');
}
}
// 指定当前生成URL地址的root
public static function root($root)
{
self::$root = $root;
Request::instance()->root($root);
}
}