mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
修复域名部署情况下,url生成 多出module_name的问题
This commit is contained in:
@@ -26,6 +26,9 @@ class Url
|
|||||||
*/
|
*/
|
||||||
public static function build($url = '', $vars = '', $suffix = true, $domain = false)
|
public static function build($url = '', $vars = '', $suffix = true, $domain = false)
|
||||||
{
|
{
|
||||||
|
if (is_bool($domain) && Config::get('url_domain_deploy')) {
|
||||||
|
$domain = true;
|
||||||
|
}
|
||||||
// 解析URL
|
// 解析URL
|
||||||
$info = parse_url($url);
|
$info = parse_url($url);
|
||||||
$url = !empty($info['path']) ? $info['path'] : '';
|
$url = !empty($info['path']) ? $info['path'] : '';
|
||||||
@@ -101,7 +104,6 @@ class Url
|
|||||||
} else {
|
} else {
|
||||||
$url .= $suffix . $anchor;
|
$url .= $suffix . $anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测域名
|
// 检测域名
|
||||||
$domain = self::parseDomain($url, $domain);
|
$domain = self::parseDomain($url, $domain);
|
||||||
// URL组装
|
// URL组装
|
||||||
@@ -139,7 +141,7 @@ class Url
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 检测域名
|
// 检测域名
|
||||||
protected static function parseDomain($url, $domain)
|
protected static function parseDomain(&$url, $domain)
|
||||||
{
|
{
|
||||||
if ($domain) {
|
if ($domain) {
|
||||||
if (true === $domain) {
|
if (true === $domain) {
|
||||||
@@ -151,6 +153,7 @@ class Url
|
|||||||
foreach (Route::domain() as $key => $rule) {
|
foreach (Route::domain() as $key => $rule) {
|
||||||
$rule = is_array($rule) ? $rule[0] : $rule;
|
$rule = is_array($rule) ? $rule[0] : $rule;
|
||||||
if (false === strpos($key, '*') && 0 === strpos($url, $rule)) {
|
if (false === strpos($key, '*') && 0 === strpos($url, $rule)) {
|
||||||
|
$url = ltrim($url, $rule);
|
||||||
$domain = $key . strstr($domain, '.'); // 生成对应子域名
|
$domain = $key . strstr($domain, '.'); // 生成对应子域名
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user