예제 #1
0
                $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY);
                foreach ($files as $name => $file) {
                    // Skip directories (they would be added automatically)
                    if (!$file->isDir()) {
                        // Get real and relative path for current file
                        $filePath = $file->getRealPath();
                        $relativePath = $rp . '/' . substr($filePath, strlen($rootPath) + 1);
                        // Add current file to archive
                        $zip->addFile($filePath, $relativePath);
                        $report .= $filePath . ' => ' . $relativePath . '<br>';
                    }
                }
            }
            foreach ($coreFiles as $file => $rp) {
                // Skip directories (they would be added automatically)
                if (!is_dir($file)) {
                    $rootPath = dirname($file);
                    // Get real and relative path for current file
                    $relativePath = $rp . '/' . substr($file, strlen($rootPath) + 1);
                    // Add current file to archive
                    $zip->addFile($file, $relativePath);
                    $report .= $file . ' => ' . $relativePath . '<br>';
                }
            }
            $zip->close();
        }
        return $report;
    }
}
Qdmvc::run();