我一直在使用codeigniter framework
。除了我無法讀取我的pdf
文件外,它與所有內容都很相配。當我嘗試閱讀時,它會下載或保存它。我嘗試了很多解決方案,但沒有奏效。用php閱讀PDF文件
控制器
public function read($name)
{
$url = base_url().'uploads/'.$name;
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="'.$name.'"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
@readfile($url);
}
設置'內容Length'過:'頭( '內容長度:'。文件大小($網址));' – Edwin