xiaoyangok 发表于 2013-1-25 03:11:55

php 改变文件目录下文件的后缀名

 
 
changeTypeName("E:/bak/video/code/views", "html", "phtml");//改变文件目录下文件的后缀名function changeTypeName($path, $oldTypaName, $newTypeName){    $path = "glob://$path/*";    $files = new DirectoryIterator($path);    foreach ($files as $file) {      $fileRealPath = $file->getRealPath(); //文件绝对路径      $compressCssFileRealPath = str_replace(".$oldTypaName", ".$newTypeName", $fileRealPath);      rename($fileRealPath, $compressCssFileRealPath);    }}  
 
页: [1]
查看完整版本: php 改变文件目录下文件的后缀名