<?php
$url = 'http://www.sina.com.cn/abc/de/fg.php?id=1&name=luhix';
function getExt($url){
$arr = parse_url($url);
/*
Array
(
[scheme] => http
[host] => www.sina.com.cn
[path] => /abc/de/fg.php
[query] => id=1&name=luhix
)
*/
$file = basename($arr['path']);
/*
fg.php
*/
$ext = explode('.',$file);
return $ext[1];
}
echo getExt($url);
?>