PHP解析URL是哪个函数?怎么用?
2023-07-06
parse_url() 是讲URL解析成有固定键值的数组的函数
$ua=parse_url(“http://username:password@hostname/path?arg=value#anchor”);
print_r($ua);
结果:
Array
(
[scheme] => http
[host] => hostname
[user] => username
[pass] => password
[path] => /path
[query] => arg=value
[fragment] => anchor
)