drsxobip501258 2016-05-20 01:57
浏览 481

使用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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 搭建pt1000三线制高精度测温电路
    • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
    • ¥15 画两个图 python或R
    • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
    • ¥15 八路抢答器设计出现故障
    • ¥15 opencv 无法读取视频
    • ¥15 按键修改电子时钟,C51单片机
    • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
    • ¥20 5037端口被adb自己占了
    • ¥15 python:excel数据写入多个对应word文档