PHP 9 ways to get a file suffix, _php tutorial

Source: Internet
Author: User

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

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.