This article mainly introduces the PHP custom extension acquisition function, and analyzes PHP's interception operation implementation skills for file extensions in the form of examples. Friends in need can refer to it
The details are as follows:
<?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");
The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
A php custom function to get the file extension
The above is the detailed content of php custom extension get function. For more information, please follow other related articles on the PHP Chinese website!