예제 #1
0
 /**
  * 面试成绩下载
  */
 public function down_interview_file($rule_id)
 {
     $uid = StudentModel::studentLoginUID();
     if (!$uid) {
         // 登录失效
         redirect('student/index/login');
     }
     //检查学生信息是否完善
     //$this->check_perfect_student();
     $name = "{$uid}.zip";
     $source_path = $rule_id . "/{$uid}.zip";
     $filepath = realpath(dirname(APPPATH)) . "/cache/zip/interview_report/" . $source_path;
     if (!file_exists($filepath)) {
         message('你的考试成绩还未生成,请稍后下载...');
     }
     header("Cache-Control: public");
     header("Content-Description: File Transfer");
     header('Content-disposition: attachment; filename=' . $name);
     //文件名
     header("Content-Type: application/zip");
     //zip格式的
     header("Content-Transfer-Encoding: binary");
     //告诉浏览器,这是二进制文件
     header('Content-Length: ' . filesize($filepath));
     //告诉浏览器,文件大小
     @readfile($filepath);
 }