使用php下载多个图像

使用php下载多个图像,php,image,Php,Image,我有一个本地托管的网站供官方使用。我需要下载一组图像在一个单一的点击。我可以转到图像文件夹并手动执行。所以我需要一个php代码来做这件事。检查这个,这将帮助你 <?php $zipname = 'adcs.zip'; $zip = new ZipArchive; $zip->open($zipname, ZipArchive::CREATE); if ($handle = opendir('.')) { while (false !== ($entry = readdir($h

我有一个本地托管的网站供官方使用。我需要下载一组图像在一个单一的点击。我可以转到
图像
文件夹并手动执行。所以我需要一个
php
代码来做这件事。

检查这个,这将帮助你

<?php

$zipname = 'adcs.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);
if ($handle = opendir('.')) {
  while (false !== ($entry = readdir($handle))) {
    if ($entry != "." && $entry != ".." && !strstr($entry,'.php')) {
        $zip->addFile($entry);
    }
  }
  closedir($handle);
}

$zip->close();

header('Content-Type: application/zip');
header("Content-Disposition: attachment; filename='adcs.zip'");
header('Content-Length: ' . filesize($zipname));
header("Location: adcs.zip");

?>

我对此一无所知。。