Home > Backend Development > PHP Tutorial > PHP url string intercepts the file name and extension of the path_PHP tutorial

PHP url string intercepts the file name and extension of the path_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 14:54:54
Original
1367 people have browsed it

php url string interception path file name and extension

function retrieve($url)
{
preg_match('//([^/]+.[a-z]+)[^/]*$/',$url,$match);
return $match[1];
}

function getExt($url)
{
$path=parse_url($url);
$str=explode('.',$path['path']);
return $str[1];
}
echo getExt('http://www.bkjia.com/ /fg.php?id=1');
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364501.htmlTechArticlephp url string intercepts the file name and extension of the path function retrieve($url) { preg_match('//( [^/]+.[a-z]+)[^/]*$/',$url,$match); return $match[1]; } ?php function getExt($url)...
source:php.cn
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