header - thinkphp如何实现弹窗下载
阿神
阿神 2017-04-10 13:10:41
0
1
689

header("Pragma: public");
header("Cache-control: max-age=".$expire);

//header('Cache-Control: no-store, no-cache, must-revalidate');
header("Expires: " . gmdate("D, d M Y H:i:s",time()+$expire) . "GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s",time()) . "GMT");
header("Content-Disposition: attachment; filename=".$showname);
header("Content-Length: ".$length);
header("Content-type: ".$type);
header('Content-Encoding: none');
header("Content-Transfer-Encoding: binary" );
if($content == '' ) {
readfile($filename);
}else {
echo($content);
}
exit();

这是http里面的一段代码,可是我用它只能读出到浏览器中。请问有什么方法点击链接如“下载”便出现一个弹框然后自己输入保存名字存起来呢?

阿神
阿神

闭关修行中......

全員に返信(1)
Peter_Zhu
header("Content-type: application/octet-stream;");

或者修改 httpd 的 mime.types 里面对应的文件类型为 application/octet-stream

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!