php从url中获取文件名和后缀等信息
$url = 'http://www.baidu.com/a/b/c/index.php?id=10';
$arr = parse_url($url);
var_dump($arr);
$arr2 = pathinfo($arr['path']);
var_dump($arr2);
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(13) "www.baidu.com"
["path"]=>
string(16) "/a/b/c/index.php"
["query"]=>
string(5) "id=10"
}
array(4) {
["dirname"]=>
string(6) "/a/b/c"
["basename"]=>
string(9) "index.php"
["extension"]=>
string(3) "php"
["filename"]=>
string(5) "index"
}