Php can be used to obtain the file suffix. I have talked a lot about how to get the extension name of a file. Today, we will summarize how to use different functions to obtain the extension name. if you need it, refer to section 1, I have talked a lot about how to get the file extension in php before. today we will summarize how to use different functions to obtain the extension. if you need it, please refer to it.
One, php explode function, function usage reference http://www.bKjia. c0m/phper/24/f486bb8b0528a628528530b295e6281b.htm
The code is as follows: |
|
$ Pic = 'ABC. php '; $ Pics = explode ('.', $ pic ); Echo $ num = count ($ pics ); Echo' '. $ Pics [$ num-1]; |
In this way, you can output
. Php.
The following uses foreach this function to use http://www.bKjia. c0m/phper/18/foreach-foreach.htm
The code is as follows: |
|
Foreach ($ pics as $ value) // 2 { $ A = $ value; } Echo $ .' '; |
To have a better function end I recommend using this function quick end function usage http://www.bKjia. c0m/w3school/php/func_array_end.htm
The code is as follows: |
|
Echo end ($ pics ); Echo' '; |
Other access methods can be determined during File upload. However, we cannot use $ _ FILES for file upload without uploading.
Login 1, php...