PHP:流式 PDF(使 PDF 只能从网页访问)

编程入门 行业动态 更新时间:2024-10-28 20:25:35
本文介绍了PHP:流式 PDF(使 PDF 只能从网页访问)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个用 PHP 构建的网站,我们有一些 PHP 页面需要登录才能生成 PDF 链接.问题在于这些 PDF(已复制到 Amazon Cloudfront)已编入索引并可用于搜索.

I have a site built in PHP and we have some PHP pages that require logging in that produce links to PDFs. The problem is that those PDFs (which were copied out to Amazon Cloudfront) were indexed and available for searching.

将现有 PDF 流式传输到浏览器的最简单方法是什么,使用户必须登录才能查看文档?我希望有一些简单的标题代码或一些我可以说在网络上无法访问的服务器上加载此文件并将其输出为 PDF"的内容.

What is the easiest way to stream an existing PDF to the browser, making it so that the user has to login to be able to see the document? I'm hoping that there is some simple Header code or something where I can say "load this file on the server that's not accessible on the web and output it as PDF".

有什么想法/建议吗?

谢谢!

推荐答案

您可以阻止对文件的访问(如其他答案中所述)或(更聪明的是,恕我直言)您可以在检查后将文件传递给浏览器PHP 中的凭据(或做几乎任何事情).这里有代码示例和讨论:bytes/topic/php/answers/159354-pass-through-any-file

You can either block access to files (as mentioned in the other answer) or (more cleverly, IMHO) you can pass the file through to the browser after checking credentials (or doing pretty much anything) in PHP. There are code examples and a discussion here: bytes/topic/php/answers/159354-pass-through-any-file

更多推荐

PHP:流式 PDF(使 PDF 只能从网页访问)

本文发布于:2023-10-07 12:25:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469384.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:流式   网页   PHP   PDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!