The code is as follows:
Copy the code The code is as follows:
$dir = 'D:Program FilesresourceapplicationSkinPNG\';//Note here Path, you need to add two at the end. The first one represents the escape, but it is easy to encounter other specific escapes, so you need to judge carefully. It can be written as follows
$dir = 'D:/Program Files/resource/ application/Skin/PNG/';//If you write a path like this, you don't have to worry about escaping. The last one/don’t miss
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if ($file != "." && $file != "..")
{
if(filetype($dir . $file) == 'file')
{
$newfile = str_replace(array('_PNG','_XML','_ICO'),array('.PNG','.XML','.ICO'), $file);
var_dump($file .' =======> '.$newfile.'
');
rename($dir . $file, $dir . $newfile);
}
}
}
closedir($dh);
}
http://www.bkjia.com/PHPjc/323936.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323936.htmlTechArticleCopy the code as follows: $dir = 'D:Program FilesresourceapplicationSkinPNG\';//Pay attention to the path here , add two at the end, the first one means changing your mind, but this way...