//首先列出需要被操作的url
$url_path = "http://www.sina.com.cn/abc/de/fg.php?id=1";
方法一:
//取出扩展名及参数
$temp = pathinfo($url_path,PATHINFO_EXTENSION);
//找到扩展名
$temp = explode("?",$temp)
echo $temp[0];
//方法二:
//将url路径进行分解,只取出目录之后的信息
$temp = parse_url($url_path);
$path = $temp['path'];
//然后再借用pathinfo直接将扩展名取出
echo pathinfo($path,PATAINFO_EXTENSION);
//方法三:
//直接取出文件名
$temp = pathinfo($url_path,PATHINFO_BASENAME);
//取出扩展名
$temp = explode(".",$temp)
echo $temp[0];