私の古い VPS では、次のコードを使用して、ディレクトリ内のファイルとディレクトリを、ユーザーがフォームを送信した後に作成された新しいディレクトリにコピーしていました。
function copyr($source, $dest)
{
// Simple copy for a file
if (is_file($source)) {
return copy($source, $dest);
}
// Make destination directory
if (!is_dir($dest)) {
mkdir($dest);
$company = ($_POST['company']);
}
// Loop through the folder
$dir = dir($source);
while (false !== $entry = $dir->read()) {
// Skip pointers
if ($entry == '.' || $entry == '..') {
continue;
}
// Deep copy directories
if ($dest !== "$source/$entry") {
copyr("$source/$entry", "$dest/$entry");
}
}
// Clean up
$dir->close();
return true;
}
copyr('Template/MemberPages', "Members/$company")
ただし、新しい VPS では、メイン ディレクトリのみが作成され、ファイルはコピーされません。2 つの VPS の間で何が変わったのかわかりませんか?