本文实例讲述了php自定义扩展名获取函数。分享给大家供大家参考,具体如下:
<?php $url = "http://www.abc.com/abc/de/fg.php?id=1"; //这个是自己写的 function getUrl($url) { $date = explode('?', $url); $date = basename($date[0]); $date = explode('.', $date); return $date[1]; } var_dump(getUrl($url)); //下面两个是网上弄的 function getExt($url){ $arr = parse_url($url); $file = basename($arr['path']); $ext = explode(".",$file); return $ext[1]; } var_dump(getExt($url)); function getName($url) { $w_param = pathinfo($url); $str = $w_param['extension']; list($type, $vars) = explode('?',$str); return $type; } echo 'start3'.date("Y-m-d H:i:s");
已抢186420个
抢已抢67227个
抢已抢352872个
抢已抢666953个
抢已抢121906个
抢已抢22955个
抢