Home > Backend Development > PHP Tutorial > PHP custom extension acquisition function example

PHP custom extension acquisition function example

巴扎黑
Release: 2023-03-03 22:44:01
Original
1243 people have browsed it

The example in this article describes the PHP custom extension acquisition function. Share it with everyone for your reference, the details are as follows:

<?php
$url = "http://www.abc.com/abc/de/fg.php?id=1";
//这个是自己写的
function getUrl($url) {
  $date = explode(&#39;?&#39;, $url);
  $date = basename($date[0]);
  $date = explode(&#39;.&#39;, $date);
  return $date[1];
}
var_dump(getUrl($url));
//下面两个是网上弄的
function getExt($url){
  $arr = parse_url($url);
  $file = basename($arr[&#39;path&#39;]);
  $ext = explode(".",$file);
  return $ext[1];
}
var_dump(getExt($url));
function getName($url) {
  $w_param = pathinfo($url);
  $str = $w_param[&#39;extension&#39;];
  list($type, $vars) = explode(&#39;?&#39;,$str);
  return $type;
}
echo &#39;start3&#39;.date("Y-m-d H:i:s");
Copy after login


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template