代码点火器使用现有文件夹创建zip文件并下载它


Codeigniter create zip file with existing folder and download it.

我正在尝试使用现有文件夹创建zip。具有子文件夹和文件的文件夹。
我正在使用代码点火器 2.1.4。为此,我尝试如下:



$this->load->library('zip');
$this->zip->read_dir($_SERVER['DOCUMENT_ROOT'].'/cloudsip_v2/apps/feb012016/'); ob_end_clean(); $this->zip->download('feb012016.zip');
但它正在下载空的zip文件。

请检查

该文件夹的许可证。

试试这个::

$name = 'mydata1.txt';
$data = 'A Data String!';
$this->zip->add_data($name, $data);
// Write the zip file to a folder on your server. Name it "my_backup.zip"
$this->zip->archive('/path/to/directory/my_backup.zip');
// Download the file to your desktop. Name it "my_backup.zip"
$this->zip->download('my_backup.zip'); 

这是链接