首页 > 代码库 > 跳出下载文本的对话框

跳出下载文本的对话框

<?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();




?>

 

跳出下载文本的对话框