php 下载文本文件

file_put_contents(ROOT_PATH . '/' . 'goods_sn.txt',$goods_id);

$yourfile="goods_sn.txt";
header ("Content-Type: application/download");
header ("Content-Disposition: attachment; filename=$yourfile");
header("Content-Length: " . filesize("$yourfile"));
$fp = fopen("$yourfile", "r");
fpassthru($fp);

 

随心网络科技 :联系QQ:1595192997

posted @ 2013-08-03 11:14  随心^_^  阅读(369)  评论(0编辑  收藏  举报