Home  >  Article  >  Backend Development  >  What are the several ways to get the url extension in php

What are the several ways to get the url extension in php

青灯夜游
青灯夜游Original
2022-02-10 15:55:412931browse

Obtaining method: 1. Use the "substr(strrchr($url,"."),1)" statement; 2. Use "substr($url,strrpos($url,'.') 1) " statement; 3. Use "pathinfo($url,PATHINFO_EXTENSION)".

What are the several ways to get the url extension in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

php gets url extension Name method

Method 1:

What are the several ways to get the url extension in php

Method 2:

 http://localhost/user [basename] => order.php [extension] => php [filename] => order )
	return $p['extension'];
}
echo get_ext2($url);
?>

Method 3:

Method 4:

Method 5:

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What are the several ways to get the url extension in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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