<?php

 

  $url = 'http://username:password@hostname/path?arg=value#anchor';

 

  print_r(parse_url($url));

 

  ?>

 

  以上例程会输出:

 

  Array

 

  (

 

  [scheme] => http

 

  [host] => hostname

 

  [user] => username

 

  [pass] => password

 

  [path] => /path

 

  [query] => arg=value

 

  [fragment] => anchor

 

  )