欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php批量修改文件后缀_PHP教程

程序员文章站 2022-05-26 07:57:44
...
function foreachDir($path){
$handle=opendir($path);
if($handle){
while (false !== ($file = readdir($handle))) {
if($file!="." && $file!='..'){
if(is_dir($path.$file)){
echo $path.$file."
";
foreachDir($path.$file);
}else{
echo "--".$path."/".$file."
";
$ext = strripos($file,'.');
$aaa = substr($file,0,$ext);
rename($path.'/'.$file,$path.'/'.$aaa.'.JPG');
// die();
}
}
}
return false;
}
}
foreachDir('D:\xampp\htdocs\TNF2');

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477908.htmlTechArticle?php function foreachDir($path){ $handle=opendir($path); if($handle){ while (false !== ($file = readdir($handle))) { if($file!=. $file!=..){ if(is_dir($path.$file)){ echo $path.$fil...