9 methods for obtaining the file suffix in php, _ PHP Tutorial

Source: Internet
Author: User
Php can obtain the file suffix in nine ways ,. Php provides nine methods for obtaining file suffixes. This article provides nine methods for php to obtain file suffixes for your reference. the specific content is as follows: php *** CreatedbyPhpStorm. * User: 9 methods for php to obtain the file suffix,

This article provides nine php methods for getting file suffixes for your reference. the specific content is as follows:

<? Php/*** Created by PhpStorm. * User: liuft * Date: 2016/3/7 * Time: * // first // function get_extension ($ file) // {// $ file = explode ('. ', $ file); // return end ($ file); //} // second // function get_extension ($ file) // {// return substr (strrchr ($ file ,'. '), 1); // The third type // function get_extension ($ file) {// return pathinfo ($ file) ['extension']; //} // type 4 // function get_extension ($ file) // {// return subst R ($ file, strrpos ($ file ,'. ') + 1); // class 5 // function get_extension ($ file) // {// $ file = preg_split ('/\. /', $ file); // return end ($ file); // class 6 // function get_extension ($ file) {// $ file = strrev ($ file); // return strrev (substr ($ file, 0, strpos ($ file ,'. '); //} // class 7 // function get_extension ($ file) // {// return pathinfo ($ file, PATHINFO_EXTENSION ); //} // class 8 // function get_extension ($ file) // {// p Reg_match_all ('/\. [a-zA-Z0-9] +/', $ file, $ data); // return! Empty ($ data [0])? Substr (end ($ data [0]), 1): ''; //} // ninth // function get_extension ($ file) {// return str_replace ('. ', '', strrchr ($ file ,'. '); //} // think so much for the moment, and then add $ file =" http://10.31.63.8:8081/M00/00/09/Ch8_CFaaMLqAO87JAACePvS0ZRk.webp "; $ Data = get_extension ($ file); var_export ($ data );

The above is all the content of this article, hoping to help you learn.

Articles you may be interested in:
  • Php code for changing all file suffixes in directories and subdirectories
  • Php code for changing all file extension extensions in directories and subdirectories
  • Function code for modifying file extensions in batches in php
  • PHP obtains the three functions with the file suffix.
  • Php method for modifying the specified file suffix
  • Php code row to get the file suffix instance analysis
  • PHP implements batch file suffix modification
  • PHP provides several common methods to get the file suffix

Examples in this article share nine php methods for getting file suffixes for your reference. the specific content is as follows: php/*** Created by PhpStorm. * User :...

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.