Home  >  Article  >  php教程  >  php怎么得到文件的后缀名

php怎么得到文件的后缀名

WBOY
WBOYOriginal
2016-06-21 09:06:211306browse

substr(strrchr(文件名,'.'),1);
-------------------------------------
STRRCHR得到最后出现。点起的字/
SUBSTR
substr("abcdef", 1, 3);  // 传回 "bcd"
字符截取。从1到三。

相关函数
strstr
传回字串中某字串开始处至结束的字串。
比如:“1。2。3。4”
STRTCHR得到是。4
STRSTR得到是。2。3。4
===================================
$available_type = explode(' ',trim($db_uploadfiletype));
$attach_ext = substr(strrchr($atc_attachment_name,'.'),1);
in_array($attach_ext,$available_type)



Statement:
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
Previous article:PHP实现的记数器Next article:日期特殊操作控制类