作者 开飞机的舒克

后台修改

@@ -194,40 +194,4 @@ class Study extends Backend @@ -194,40 +194,4 @@ class Study extends Backend
194 $this->success(); 194 $this->success();
195 } 195 }
196 196
197 - /**  
198 - * 批量下载  
199 - */  
200 - public function download($ids)  
201 - {  
202 - $list = $this->model->where('id ', 'in', $ids)->select();  
203 - $zip = new \ZipArchive;  
204 - $filename = 'tmp/' . date('Ymd',time()) . '_u' . $this->auth->id . '_reports.zip';  
205 - if ($zip->open($filename,\ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE){  
206 - foreach ($list as $publish) {  
207 - $filepath = 'uploads' . 'l' . $publish->file;  
208 - if (!file_exists($filepath)) {  
209 - $this->error($publish->code . '文件未找到');  
210 - }else {  
211 - $zip->addFile($filepath, basename($filepath));  
212 - }  
213 - }  
214 - }  
215 - //打包zip  
216 - $zip->close();  
217 - if (!file_exists($filename)) {  
218 - $this->error('创建下载文件失败!');  
219 - }  
220 - Header("Cache-Control : public");  
221 - Header("Content-type: application/octet-stream");  
222 - // Header("Content-type: application/zip");  
223 - header("Content-Transfer-Encoding : binary");  
224 - Header("Accept-Length: " . filesize($filename));  
225 - Header( "Cache-Control : public");  
226 - Header( "Content-type: application/octet-stream");//Header( "Content-type: application/zip");  
227 - header( "Content-Transfer-Encoding: binary");  
228 - Header( "Accept-Length: " . filesize($filename));  
229 - Header("Content-Disposition: attachment; filename=" . basename($filename));//输出文件内容  
230 - readfile($filename);flush();  
231 - // return json(0);  
232 - }  
233 } 197 }