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)
-------------------------------------
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)
本文介绍了如何使用PHP函数strrchr和substr来获取文件扩展名,并通过explode和in_array函数检查该扩展名是否属于允许上传的类型。这些函数在处理文件上传及验证过程中非常实用。
561

被折叠的 条评论
为什么被折叠?



