parse_url()解析url

// php解析url,返回其组成部分,函数:parse_url()

URL: http://username:password@hostname/path?arg=value#anchor
		var_dump(parse_url($url));
	
array(7) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(8) "hostname"
  ["user"]=>
  string(8) "username"
  ["pass"]=>
  string(8) "password"
  ["path"]=>
  string(5) "/path"
  ["query"]=>
  string(9) "arg=value"
  ["fragment"]=>
  string(6) "anchor"
}

		print_r(parse_url($url));
	
Array
(
    [scheme] => http
    [host] => hostname
    [user] => username
    [pass] => password
    [path] => /path
    [query] => arg=value
    [fragment] => anchor
)

你可能感兴趣的:(parse_url()解析url)