文件对话框未显示-php

时间:2014-01-31 13:11:01

标签: php

php代码工作正常,文件在chrome状态栏下载。但是它没有显示文件下载对话框,chrome正在自动下载文件。想要显示文件下载对话框。试过不同的内容类型,但它不起作用。
粘贴下面的php代码

<?php
header('Content-disposition: attachment; filename=index.html');
header('Content-type: text/plain');
readfile('index.html');
?>

1 个答案:

答案 0 :(得分:3)

这是浏览器下载文件的实现。 Internet Explorer将提示用户保存文件的位置,Chrome不会。这不取决于你; - )。