ereg(正规表达式,字符串,[匹配部分数组名]);
更多详细内容请查看:http://www.bkjia.com/phper/18/2a94e504e94424a7a461342d049c0018.htm
本程序利用了ereg来验证用户上传的文件类型与文件名是否是符合文件命名规则。
*/
if( !is_uploaded_file($upfile) ) { echo("你什么都没有上传哦!"); exit(); } else { if( !ereg(".(htm|html)$", $upfile_name) ) { echo("dedecms模板只能用 .htm 或 .html扩展名!"); exit(); } if( ereg("[/]",$upfile_name) ) { echo("模板文件名有非法字符,禁止上传!-1"); exit(); } move_uploaded_file($upfile, $templetdird.'/'.$upfile_name); @unlink($upfile); echo("成功上传一个文件!"); exit(); } exit();
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号