Php is a simple way to get the file extension. Php simple method of getting File extensions this article mainly introduces php simple method of getting file extensions, examples of php's skills in getting file extensions, some reference methods for obtaining the file extension in php
This article mainly introduces php's simple method of getting file extensions. The example analyzes php's skills for getting File extensions and has some reference value. For more information, see
This example describes how to obtain the file extension in php. Share it with you for your reference. The specific implementation method is as follows:
?
|
1
2
3
4
5
6
7
8
9
10
11
12 |
Function get_file_extension ($ file_name)
{
/* May contain multiple dots */
$ String_parts = explode ('.', $ file_name );
$ Extension = $ string_parts [count ($ string_parts)-1];
$ Extension = strtolower ($ extension );
Return $ extension;
}
$ Str = "img.jpg ";
Echo get_file_extension ($ str); // output: jpg
?>
|
I hope this article will help you with php programming.
This article mainly introduces php's simple method of getting the file extension. The example analyzes the php's technique of getting the file extension, which has some reference price...