代码点火器-PHP-仅在iPhone上的Pdf文件下载问题

时间:2018-10-06 08:16:53

标签: php codeigniter downloading

我在代码点火器控制器中创建了一个函数,以在单击下载后返回文件。它适用于所有设备,但不适用于仅iPhone。我不明白是什么问题,或者我缺少什么。

仅在iPhone设备上,它会返回垃圾。

控制器方法:

 public function download_document($project_id,$file_name){ 
        $doc_path=site_url('documents/projects/'.$project_id.'/'.$file_name); 
        header('Content-Description: File Transfer');
        header('Content-Type: application/pdf');
        header('Content-Disposition: attachment; 
        filename='.basename($doc_path));
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($doc_path));
        ob_clean();
        flush();
        $file= readfile($doc_path);

    // The PDF source is in original.pdf 
    return $file;

        }

调用方法的输出

enter image description here

0 个答案:

没有答案
相关问题