跳出下载文本的对话框

<?php
function downfile()
{
 $filename=realpath("https://www.baidu.com/"); //文件名
 $date=date("Ymd-H:i:m");
 Header( "Content-type:  application/octet-stream "); 
 Header( "Accept-Ranges:  bytes "); 
Header( "Accept-Length: " .filesize($filename));
 header( "Content-Disposition:  attachment;  filename= {$date}.doc"); 
 echo file_get_contents($filename);
 readfile($filename); 
}
downfile();




?>

 

posted @ 2017-02-06 10:06  Ali.Blacken  阅读(177)  评论(0编辑  收藏  举报