php-Zip未在CodeIgniter中下载

我使用jQuery将一些数据发布到页面上,并使用CodeIgniter中的zip库下载zip文件,它仅输出一些字符串数据,并且下载不起作用.

Output error String data

码:

$data = json_decode($data);
foreach ($data as $id) {
    $this->db->where('idjobs', $id);
    $this->db->where('jobs_has_clients.jobs_idjobs', $id);
    $this->db->join('status', 'status.idstatus = jobs.status_idstatus', 'left');
    $this->db->join('jobs_has_clients', 'jobs_has_clients.jobs_has_clientsSet = status.statusFor', 'left');
    $this->db->join('cv', 'cv.clients_idclients = jobs_has_clients.clients_idclients', 'left');
    $get_all_data_q = $this->db->get('jobs');
    $all_data_to_array_q = $get_all_data_q->result_array();
    $a = 0;
    foreach ($all_data_to_array_q as $zipData) {
        $path = './' . $zipData['cvFilePath'];
        $this->zip->read_file($path);
        $a++;
    }

    if ($a != 0) {
        $this->zip->download('job_' . $id . '_' . date('Y-m-d') . '_cv_archive.zip');
    }
}

解决方法:

您无法从Ajax查询启动下载.您应该从浏览器而不是jQuery加载脚本.

相关文章

IE6是一个非常老旧的网页浏览器,虽然现在很少人再使用它,但...
PHP中的count()函数是用来计算数组或容器中元素的个数。这个...
使用 AJAX(Asynchronous JavaScript and XML)技术可以在不...
Ajax(Asynchronous JavaScript and XML)是一种用于改进网页...
本文将介绍如何通过AJAX下载Excel文件流。通过AJAX,我们可以...
Ajax是一种用于客户端和服务器之间的异步通信技术。通过Ajax...