优化ws返回的地址
This commit is contained in:
parent
08704e7f60
commit
aca1a4d34c
@ -756,7 +756,11 @@ class Base
|
|||||||
) {
|
) {
|
||||||
return $str;
|
return $str;
|
||||||
} else {
|
} else {
|
||||||
return Base::leftDelete(url($str), "http://localhost");
|
$url = url($str);
|
||||||
|
if (str_starts_with($url, "http://localhost/")) {
|
||||||
|
$url = self::localhostAndPort() . substr($url, 17);
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,8 +777,16 @@ class Base
|
|||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
$find = url('');
|
$str = Base::leftDelete($str, url('') . '/');
|
||||||
return Base::leftDelete($str, $find . '/');
|
return Base::leftDelete($str, self::localhostAndPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取localhost和端口,如:http://localhost:8888/
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function localhostAndPort() {
|
||||||
|
return "http://localhost:" . env("APP_PORT", "80") . "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user