更新时间:2022-04-02 22:39:18
您可以使用 parse_url 下来到主机名.
You can use parse_url to get down to the hostname.
例如:
$url = "http://localhost/path/to/?here=there";
$data = parse_url($url);
var_dump($data);
/*
Array
(
[scheme] => http
[host] => localhost
[path] => /path/to/
[query] => here=there
)
*/