最後更新: 2024-07-03
目錄
parse_url
mixed parse_url ( string $url)
<?php $url = 'http://username:password@hostname:80/path?arg=value#anchor'; print_r(parse_url($url)); echo parse_url($url, PHP_URL_PATH); ?>
output
Array ( [scheme] => http [host] => hostname [port] => 80 [user] => username [pass] => password [path] => /path [query] => arg=value [fragment] => anchor )
/path
# query - after the question mark ?
# fragment - after the hashmark #