public function throwParseError() { $error = error_get_last(); if ($error && in_array($error['type'], array(1, 4, 16, 64, 256, 4096, E_ALL))) { $error = array('code' => $error['type'], 'msg' => $error['message'], 'trace' => $error['file'] . ' In Line:' . $error['line'], 'data' => '', 'runTime' => RunTime::getTime()); $this->pushError($error); $this->outputError($error); } }
/** * 统计系统写日志方法 * @param array $request 请求信息(二维数组) array('time'=>'','type'=>'',array('url'=>'','event'=>'','runTime'=>'','realTime'=>'','status'=>'')) * @param [type] $result [description] */ public static function addStatLog($request) { $data = $request['data']; $data['time'] = $request['time']; $data['type'] = $request['type']; self::$loglist['stats'][] = $data; self::$loglist['runTime'] = RunTime::getTime(); return true; }
<?php session_start(); header("Cache-control: private"); header("Content-Type: text/html; charset=utf-8"); if (empty($_SESSION["cn_sysadmin"])) { die("<script>top.location.href='login.php'</script>"); } require_once '../includes/RunTime.class.php'; require_once '../configs/db.inc.php'; require_once '../configs/smarty.inc.php'; require_once '../includes/Pager.class.php'; require_once '../includes/utils.func.php'; require_once '../includes/init.php'; $smarty->caching = false; $RunTime = new RunTime(); $RunTime->start();
/** * 程序运行花费的时间 */ public static function spent() { self::$_spentTime = self::$_topTime - self::$_startTime; //返回获取到的程序运行时间差 microtime() 单位是微秒 return number_format(self::$_spentTime * 1000, 4) . 'ms'; }
/** * @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(); }