PHP【URL扩展截取】 么得感情的攻城狮 2023-02-22 99 阅读1分钟 从给定的URL中截取扩展名 $url = 'http://www.sina.com.cn/abc/de/fg.php?id=1&a=123'; function getExt($url){ $p = parse_url($url); return pathinfo($p['path'], PATHINFO_EXTENSION); } echo getExt($url);