PHP Get file name suffix example summary_PHP tutorial
WBOY
Release: 2016-07-13 10:44:57
Original
1048 people have browsed it
When uploading PHP files, we need to obtain the file name suffix and then make a simple file type judgment. The method of obtaining the file name suffix in PHP is very simple and there are many ways. Let me summarize it below.
Run result:
Directory name: /usr/www/html
File name: index.php
Extension: php
4.realpath -- Returns the normalized absolute path name
The php code is as follows:
Finally, pay attention to a little tip: the file path operators of different paths may be different. You can use "/" and "" under Windows,
Under Linux, you can only use "/", so when developing, it is recommended to use "/", as I wrote the file path above!
//Method 1:<🎜>
{ <🎜>
$file_name = substr($file_name, $dot+1); <🎜>
} <🎜>
return $file_name; <🎜>
} <🎜>
<🎜>
<🎜>
<🎜>
<🎜>?>
http://www.bkjia.com/PHPjc/633058.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633058.htmlTechArticleWhen uploading php files, we need to obtain the file name suffix and then make a simple file type judgment, and in php files There are many ways to obtain a name suffix. Let me summarize it below...
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn