PHP 9 ways to get a file suffix,
The example of this article for you to share 9 kinds of PHP to obtain the file suffix method for your reference, the specific content as follows
<?php/** * Created by Phpstorm. * User:liuft * DATE:2016/3/7 * time:15:46 *//the first//function get_extension ($file)//{//$file = Explode ('. ', $file);// Return End ($file)//}//second/function get_extension ($file)//{//Return substr (STRRCHR ($file, '. '), 1);//}//Third type/ /function Get_extension ($file) {//return PathInfo ($file) [' extension '];//}////Fourth//function get_extension ($file)//{ Return substr ($file, Strrpos ($file, '. ') + 1),//}//Fifth//function get_extension ($file)//{//$file = Preg_split ('/\./', $file);//Return End ($file)//}//Sixth type/function Get_extension ($file) {//$file = Strrev ($file);//Return Strrev (Subs TR ($file, 0,strpos ($file, '. '))); /}////Seventh type/function Get_extension ($file)//{//Return PathInfo ($file, pathinfo_extension);//}////Eighth//function get _extension ($file)//{//Preg_match_all ('/\.[ a-za-z0-9]+/', $file, $data);//Return!empty ($data [0])? substr (End ($data [0]), 1): ";//}//Nineth type/function get_extension ($file) {//Return Str_replace ('. ', ',STRRCHR ($file, '. ')); /}//think so much for the time being, and later to add $file = "HTTP://10.31.63.8:8081/M00/00/09/CH8_CFAAMLQAO87JAACEPVS0ZRK.WEBP"; $data = Get_extension ($file); Var_export ($data);
The above is the whole content of this article, I hope that everyone's study has helped.
Articles you may be interested in:
- PHP changes the code of all the file suffixes in the directory and subdirectories
- PHP changes the code for all file suffix extensions under directories and subdirectories
- function code for bulk modification of file suffix names in PHP
- PHP three functions to get the file suffix name
- How PHP modifies the specified file suffix
- PHP Line code get file suffix Mingshi example analysis
- PHP implementation of Bulk modification of file suffix name method
- Some common methods of obtaining file suffix in PHP implementation
http://www.bkjia.com/PHPjc/1113715.html www.bkjia.com true http://www.bkjia.com/PHPjc/1113715.html techarticle PHP to obtain the file suffix of 9 methods, the example of this article for you to share 9 ways to get the file suffix PHP, for your reference, the specific content as follows php/** * Created by Phpstorm. * User: ...