Php file suffix multiple methods _ PHP Tutorial

Source: Internet
Author: User
Tags php explode
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...

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.