我在这些文件夹中有文件夹名称data1和data2,我有10个文件,文件名不同。我只想用data2目录重命名title data1文件夹。我只能够显示两个目录文件名。请给我个主意。
<?php
$dir1 = "data1/";
$dir2 = "data2/";
/* Hide this */
$hideName = array('.','..','.DS_Store');
// Sort in ascending order - this is default
$files = scandir($dir1);
/* While this to there no more files are */
foreach($files as $filename) {
if(!in_array($filename, $hideName)){
/* echo the name of the files of dir1 */
echo "$filename<br>";
}
}
$files = scandir($dir2);
/* While this to there no more files are */
foreach($files as $filename) {
if(!in_array($filename, $hideName)){
/* echo the name of the files of dir2 */
echo "$filename<br>";
}
}
?>