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); } }
?
?