-1
當我在localhost上執行下面的代碼但pdf未打開。使用php在瀏覽器中打開pdf文件?
將顯示PDF打開失敗的信息。任何問題這個代碼?
<?php
//$file = $_POST["image"];
//$filename = $_POST["fname"];
$file = '/home/Desktop/GH-07/hospitalpdf/10004.pdf';
$filename = 'fit.pdf';
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
//header('Content-Disposition: inline; filename=''.$filename.''');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
@readfile($file);
?>
使用錯誤報告並找出http://php.net/manual/en/function.error-reporting.php –
謝謝。我會查的 – krishna