public function download() { $contribute_id = intval($this->input['id']); $sql = 'SELECT * FROM ' . DB_PREFIX . 'materials WHERE content_id=' . $contribute_id; $material = array(); $query = $this->db->query($sql); while ($row = $this->db->fetch_array($query)) { $material[] = $row['dir'] . $row['material_path'] . $row['pic_name']; } if (!$material) { $this->errorOutput('该报料不存在图片素材,下载失败'); } include_once ROOT_PATH . 'lib/class/material.class.php'; $material_server = new material(); $str = ''; foreach ($material as $m) { $str .= ',' . $m; } $str = trim($str, ','); $zip = $material_server->zip_material($str); $zip_url = $zip[0]; $this->addItem($zip_url); $this->output(); }