繁体   English   中英

Codeigniter使用现有文件夹创建zip文件并下载。

[英]Codeigniter create zip file with existing folder and download it.

我正在尝试使用现有文件夹创建zip。 该文件夹包含子文件夹和文件。
我正在使用codeigniter 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'); 

这是链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM