使用 PHP 打开下载对话框
我正在尝试制作一个在线 kickstart 配置文件创建器.在服务器上创建文件后,如何弹出下载对话框以便用户下载?
I am trying to make an online kickstart config file creator. After the file is created on the server how do I get the download dialog to pop up so the user can download it?
推荐答案
Content-Disposition header..
Content-Disposition header..
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
http://au2.php.net/manual/en/function.头文件
相关文章