Php provides multiple methods to obtain document extensions

Source: Internet
Author: User
Php to obtain the file suffix in multiple ways, phpexplode function, function usage reference ?? The code is as follows: Copy the code $ pic = 'ABC. php '; $ pics = explode ('. ', $ pic); echo $ num = count ($ pics); echo' & lt; multiple methods for getting the file suffix in br php

I. php explode function. for function usage reference ?? 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? Usage of this function ?? The code is as follows:
Foreach ($ pics as $ value) // 2
{
? $ A = $ value;
}
Echo $ .'
';
?

Is there a better function end? I recommend using this function to quickly end the function usage ?? 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.

For more details, see: http://www.111cn.net/phper/php/42034.htm

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.