日期:2013-06-14  浏览次数:20431 次

<?php
function download($file_source, $file_target
) {
      
$rh = fopen($file_source, 'rb'
);
      
$wh = fopen($file_target, 'wb'
);
       if (
$rh===false || $wh===false
) {
// error reading or opening file
          
return true
;
       }
       while (!
feof($rh
)) {
           if (
fwrite($wh, fread($rh, 1024)) === FALSE
) {
                  
// 'Download error: Cannot write to file ('.$file_target.')';
                  
return true