示例#1
0
 /**
  * @Title: Download 
  * @Description: todo(下载)   
  * @author laicaixia 
  * @date 2013-6-2 上午10:30:49 
  * @throws 
  */
 public function Download()
 {
     $path = !empty($_REQUEST['path']) ? $_REQUEST['path'] : "";
     @set_time_limit(C('PAGE_LIFE_TIME'));
     //设置该页面最久执行时间为300秒
     import("@.ORG.RunTime");
     import("@.ORG.HttpDownload");
     $postfix = end(explode(".", $path));
     /*	if($path==$postfix or ($postfix!="zip" or $postfix!="Zip" or $postfix!="ZIP")){
     		 echo "下载程序非ZIP文件,请检查下载文件!";
     		exit;
     		}*/
     $runtime = new RunTime();
     $runtime->start();
     #下载文件
     $file = new HttpDownload();
     # 实例化类
     //$file->OpenUrl("http://www.ti.com.cn/cn/lit/an/rust020/rust020.pdf"); # 远程文件地址
     $file->OpenUrl($path);
     //$file->OpenUrl("http://dl_dir.qq.com/qqfile/qq/QQ2010/QQ2010Beta3.exe"); # 远程文件地址
     //重命名下载文件
     $filename = "Upgrade.zip";
     //$folder=date('Y-m-d');
     //$folderdir=C('UPGRADE_PATH');
     $aimDir = C('UPGRADE_PATH') . "/" . date('Y-m-d');
     $file->SaveToBin($filename, $aimDir);
     // 保存路径及文件名
     $file->Close();
     # 释放资源
     $runtime->stop();
     echo "总下载时间:" . $runtime->spent();
 }