教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php批量修改文件扩展名的代码

php批量修改文件扩展名的代码

发布时间:2016-12-03   编辑:jiaochengji.com
教程集为您提供php批量修改文件扩展名的代码等资源,欢迎您收藏本站,我们将为您提供最新的php批量修改文件扩展名的代码资源
提供一个实例的php自定义函数,这是一个可以批量修改文件后缀名的php程序,有需要的朋友可以参考一下。
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy3265')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy3265>
<?opendir($path);
if($handle){
while (false !== ($file = readdir($handle))) {
if($file!="." && $file!='..'){
if(is_dir($path.$file)){
echo $path.$file."<br/>";
foreachDir($path.$file);
}else{
echo "--".$path."/".$file."<br/>";
$ext = strripos($file,'.');
$aaa = substr($file,0,$ext);
rename($path.'/'.$file,$path.'/'.$aaa.'.JPG');
// die();
}
}
}
return false;
}
}
foreachDir('D:xampphtdocsTNF2');

您可能感兴趣的文章:
dos命令批量修改文件扩展名的例子
php批量修改文件扩展名的代码
linux下批量修改文件后缀的方法
linux批量修改文件名的shell脚本
一个批量修改文件后缀名的php函数
dos变量定义和引用方法
获取一个目录下所有文件扩展名的批处理
awk 单行命令批量修改文件名
PHP添加CURL扩展库的二种方法
批处理的字符串处理

[关闭]
~ ~