Yesterday, and a friend in the PHP Exchange group (276167802, verify: CSL, interested words can join in the discussion together) mentioned
PHP6 ways to get the file extension, now take it out and share it with you:
1. How to find and intercept strings
$extension =substr (STRRCHR ($file, '. '), 1);
2, String search and interception method two
$extension =substr ($file, Strrpos ($file, '. ') +1);
3, the method of array segmentation
$extension =end (Explode ('. ', $file));
4, the use of PathInfo Direct analysis method
$info = PathInfo ($file); $extension = $info [' extension '];
5. Use the second parameter of PathInfo
$extension =pathinfo ($file, pathinfo_extension);
6. Using the Finfo_file function
$finfo = Finfo_open (fileinfo_mime_type), $extension = Finfo_file ($finfo, $file); Echo $extension; Finfo_close ($finfo);
http://www.bkjia.com/PHPjc/621640.html www.bkjia.com true http://www.bkjia.com/PHPjc/621640.html techarticle yesterday, and a friend in the PHP Exchange group (276167802, verify: CSL, interested words can join in the discussion together) mentioned in PHP to get the extension of the file 6 methods, now take out ...