PHP obtains the three functions with the file suffix.
Source: Internet
Author: User
PHP gets the file suffix. There are many ways to get the file extension. the following three methods are provided to get the file suffix. you can study it and the specific code will not be explained. Let's look at the code and select a method to remember. you can use it directly when you need it later, or you can click here to view this article.
The code is as follows:
// Method 1:
Function extend_1 ($ file_name)
{
$ Retval = "";
$ Pt = strrpos ($ file_name ,".");
If ($ pt) $ retval = substr ($ file_name, $ pt + 1, strlen ($ file_name)-$ pt );
Return ($ retval );
}
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.