我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

使用php在浏览器中显示pdf

hi so im trying to display a pdf file in the browser using php so i used this code

<?php
    $filename = "uploads/docs/Preamble and National Territory.pdf";
    header("Content-type: application/pdf");
    header("Content-Length: " . filesize($filename));
    readfile($filename);
    exit;
?>

i juat hardcoded the pdf file name but will change it later my problem is it does not load the pdf file in my browser here is what it says

enter image description here

any idea how to improve my code? or what im doing wrong? thanks in advance

近期文章

  • 通过限制雄辩关系的结果来减少查询加载时间
  • 查看用户是否发送了图像
  • 将微调器值转换为要在php中使用的字符串
  • 在laravel 5.1中显示2个表格中的数据详细信息
  • 通过php查找目录中的所有mp3文件
  • PHP MySQL多个连接
  • PHPExcel在xls和xlsx之间切换
  • 如何动态更改yii常量?
  • 如何使用php和cURL从Web服务获得响应
  • Paypal PHP REST API - 在结账时显示没有付款值
  • laravel学生自定义登录系统的问题
  • 过滤Admin中的关系模型字段 - CGridView
  • 如何在一个请求中创建,下载和删除文件
  • 如何在Android Studio中的变量中存储MySQL数据? [重复]
  • 使用PHP获取png类型
  • 在yii2上使用Pjax时出错
  • 亲子排序
  • Magento FedEx集成测试
  • 从chrome-browser发送消息到ubuntu中的bash脚本来控制键盘指示灯
  • 如何在ci中使用form_validation中所需的?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华