php实现下载功能_php资料_编程技术-你的首页-uuhomepage.com ob_start(); //显示下载的内容----- echo "大家好!"; //include "logo_page.php"; //-----------------显示完毕-- ?> //生成对应的下载文件-------------------- $this_my_f= ob_get_contents(); //此处关键 ob_end_clean(); $filename="".$_GET['id'].".html"; $filename = "download/".$filename; if(tohtmlfile_cjjer($filename,$this_my_f)){ //---------------生成完毕 //开始下载---------- $NomFichier = basename($filename); $taille=filesize($filename); ob_end_clean(); header("Content-Type: application/force-download; name=$NomFichier"); header("Content-Transfer-Encoding: binary"); header("Content-Length: $taille"); header("Content-Disposition: attachment; filename=$NomFichier"); header("Expires: 0"); header("Cache-control: private"); header("Pragma: no-cache"); readfile($filename); } //----------------下载完毕 /*/
?>
|