介绍
使用php怎么对文件扩展名进行判断?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
& lt; ! DOCTYPE> & lt; html> & lt; head> ,& lt; meta  http-equiv=癈ontent-type",内容=拔谋?html", charset=皍tf-8"比; ,& lt; title> check file</title> & lt;/head> & lt; body> & lt; b>文件扩展名验证& lt;/b> & lt; input 类型=皌ext", name=癷nt",价值=https://www.yisu.com/zixun/拔募hp“onblur=凹觳?这)" id=" int "> <>脚本 函数检查(obj) { 如果(obj。值==" | | obj.value.length <3) { alert("输入的长度不能小于3且不能为空! "); obj.focus (); } } 函数check_value () { var str=$ value (“int”); var repx=/?php | asp | jsp) $/我; var类型=str.substring (str.lastIndexOf (“。”), str.length); 如果(type.match (repx) & & str.lastIndexOf (“。”) !=1) { alert("文件扩展名正确”); $ (“int”) .focus (); 其他}{ alert("文件扩展名有误”); $ (“int”) .focus (); } } 函数美元(obj) { 返回. getelementbyid (obj); }> 脚本 身体>