当前位置: 代码迷 >> PHP >> php 改变文件目录上文件的后缀名
  详细解决方案

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

热度:28   发布时间:2016-04-28 22:46:45.0
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);    }}
?

?

?

  相关解决方案