时间:2021-07-01 10:21:17 帮助过:10人阅读
function retrieve($url)
{
preg_match('/\/([^\/]+\.[a-z]+)[^\/]*$/',$url,$match);
return $match[1];
}
function getExt($url)
{
$path=parse_url($url);
$str=explode('.',$path['path']);
return $str[1];
}
echo getExt('http://www.bkjia.com//fg.php?id=1');
?>
http://www.bkjia.com/PHPjc/364501.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/364501.htmlTechArticlephp url字符串截取路径的文件名和扩展名 function retrieve($url) { preg_match('/\/([^\/]+\.[a-z]+)[^\/]*$/',$url,$match); return $match[1]; } ?php function getExt($url)...