怎么样使用php自定义扩展名获取函数?
本文实例讲述了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");
希望本文所述对大家PHP程序设计有所帮助。
本文地址:http://www.45fan.com/bcdm/90019.html