用PHP打开下载对话框 [英] Open Download Dialog with PHP

查看:128
本文介绍了用PHP打开下载对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个在线kickstart配置文件的创建者。在服务器上创建文件后,如何让下载对话框弹出,以便用户可以下载?

解决方案

Content-Disposition头..

  //我们将输出一个PDF 
头('Content-type:应用/ PDF');
//将被称为DOWNLOAD.pdf
标头('Content-Disposition:attachment; filename =uploaded.pdf');
// PDF源码是original.pdf
readfile('original.pdf');

http://au2.php.net/manual/en/function.header.php


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..

// 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.header.php

这篇关于用PHP打开下载对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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