PHP-将文件发送给用户 [英] PHP - send file to user

查看:95
本文介绍了PHP-将文件发送给用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在磁盘上有一个pdf文件,当他们向php脚本发出请求时,我需要将该文件发送给用户,这样做的最佳方法是什么?

I have a pdf file on disk that i need to send to a user when they make a request to a php script, what is the best way of doing this?

谢谢

推荐答案

假定它在服务器上:

readfile()-输出文件

readfile() — Outputs a file

来自 http://php.net/manual/en/function.readfile的示例. php

这篇关于PHP-将文件发送给用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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