mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进Url生成的别名获取后的域名和后缀拼接
This commit is contained in:
@@ -26,10 +26,6 @@ class Url
|
|||||||
*/
|
*/
|
||||||
public static function build($url = '', $vars = '', $suffix = true, $domain = true)
|
public static function build($url = '', $vars = '', $suffix = true, $domain = true)
|
||||||
{
|
{
|
||||||
// 检测是否存在路由别名
|
|
||||||
if ($aliasUrl = Route::getRouteUrl($url, $vars)) {
|
|
||||||
return $aliasUrl;
|
|
||||||
}
|
|
||||||
// 解析参数
|
// 解析参数
|
||||||
if (is_string($vars)) {
|
if (is_string($vars)) {
|
||||||
// aaa=1&bbb=2 转换成数组
|
// aaa=1&bbb=2 转换成数组
|
||||||
@@ -44,8 +40,13 @@ class Url
|
|||||||
$vars = array_merge($params, $vars);
|
$vars = array_merge($params, $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检测是否存在路由别名
|
||||||
|
if ($aliasUrl = Route::getRouteUrl($url, $vars)) {
|
||||||
|
// 存在别名定义则优先
|
||||||
|
return $aliasUrl;
|
||||||
|
} else {
|
||||||
// 检测路由
|
// 检测路由
|
||||||
$match = self::checkRoute($url, $vars, $domain, $type);
|
$match = self::checkRoute($url, $vars, $domain);
|
||||||
if (false === $match) {
|
if (false === $match) {
|
||||||
// 路由不存在 直接解析
|
// 路由不存在 直接解析
|
||||||
if (false !== strpos($url, '\\')) {
|
if (false !== strpos($url, '\\')) {
|
||||||
@@ -68,6 +69,8 @@ class Url
|
|||||||
// 处理路由规则中的特殊内容
|
// 处理路由规则中的特殊内容
|
||||||
$url = str_replace(['\\d', '$'], '', $match);
|
$url = str_replace(['\\d', '$'], '', $match);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 检测URL绑定
|
// 检测URL绑定
|
||||||
$type = Route::bind('type');
|
$type = Route::bind('type');
|
||||||
if ($type) {
|
if ($type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user