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

你可能感兴趣的:(File)