从PHP header()手册:
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
Run Code Online (Sandbox Code Playgroud)
更改内容类型和文件名.您可以通过file_get_contents使用readfile,但是要么工作要么应该工作.
| 归档时间: |
|
| 查看次数: |
997 次 |
| 最近记录: |