PHP:流式 PDF(使 PDF 只能从网页访问) [英] PHP: Stream PDF (make PDF accessible only from webpage)

查看:36
本文介绍了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 中的凭据(或做几乎任何事情).这里有代码示例和讨论:http://bytes.com/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: http://bytes.com/topic/php/answers/159354-pass-through-any-file

这篇关于PHP:流式 PDF(使 PDF 只能从网页访问)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆