Posted in PHP onDecember 12, 2016
本文实例讲述了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程序设计有所帮助。
php自定义扩展名获取函数示例
- Author -
qq_26702065声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@