Codeigniter压缩部分大文件夹

时间:2016-12-20 16:41:06

标签: php codeigniter zip gzip ziparchive

我想在分割的zip文件中压缩一个大文件夹。我使用了经典的codeigniter代码,我想使用popenstream,但我不知道该怎么做。我希望有人帮助我。

我的代码是:

public function exportar_pastas() {

    ini_set('max_execution_time', 4600);
    ini_set('memory_limit','7024M');
    $username="";

    if($_POST){
        $this->load->library('zip');
        $user = $this->input->post("nome");
        $users = $this->user_model->get_users();

        foreach($users as $userm){
            if($userm->user_id == $user){
                $username = $userm->username;
            }
        }

        $path = "../certificados/".$username;
        $this->zip->read_dir($path); 
        $handle = $this->zip->download('my_backup.zip');
        while (!feof($handle)){
            echo fread($handle, 8000);
            flush();
        }
        redirect(base_url().'admin/backup');
    }else{
        $this->load->view('admin/backup');
    }
}

0 个答案:

没有答案