hao1nan 发表于 2017-3-3 09:48:47

php readfile

simple one

<?php
$content = array('132','654');
$file = 'combine.txt';
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
//header('Content-Length: ' . filesize($file));
ob_clean();
flush();
foreach($content as $item){
echo $item;
}
//readfile($file);
exit;


more complex one:
https://gist.github.com/854168
页: [1]
查看完整版本: php readfile