时间:2021-07-01 10:21:17 帮助过:4人阅读
无标题文档
$a = array();
$dir = '/var/www/html';
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/\.png$/", $file)) $a[] = $file;
elseif (preg_match("/\.gif$/", $file)) $a[] = $file;
}
closedir($handle);
}
foreach ($a as $i) {
copy($dir . '/' . $i, '$dir . '/images/' . $i);
}