In PHP sometimes we want to get the extension of the upload file, below I summarize the extension in PHP to get a summary of the method, there is a need for friends to refer to.
Method One, my own most kind of get extension method
| The code is as follows |
Copy Code |
function Extend_2 ($file _name) { $extend = PathInfo ($file _name); $extend = Strtolower ($extend ["extension"]); return $extend; } |
Method Two, combining operations with the End function using the EXPLODE function
| The code is as follows |
Copy Code |
function Get_extension ($file) { Return End (Explode ('. ', $file)); } |
Method Three, is the same as before the extension in the ASP to get the same practice.
| The code is as follows |
Copy Code |
function Get_extension ($file) { substr (STRRCHR ($file, '. '), 1); } |
Okay, here are the three kinds of methods, basically to meet you get the file name extension.
http://www.bkjia.com/PHPjc/628928.html www.bkjia.com true http://www.bkjia.com/PHPjc/628928.html techarticle in PHP Sometimes we want to get the extension of the upload file, below I summarize the extension in PHP to get a summary of the method, there is a need for friends to refer to. Method One, my own one of the most won ...