PHP实现文件下载

<?php
    $FilePath = 'abc.txt';
    $file = fopen("php://output", 'w');

Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); Header("Accept-Length: ".filesize('abc.txt')); Header("Content-Disposition: attachment; filename=".'abc.txt'); echo fread($file, filesize($FilePath)); fclose($file);

 

posted @ 2017-05-24 15:55  Skrillex  阅读(218)  评论(0编辑  收藏  举报

power by Skrillex 2008