예제 #1
0
 public function get($url)
 {
     $option = array(CURLOPT_URL => $url, CURLOPT_POST => false);
     curl_setopt_array($this->handle, $option);
     $begin = Time::ms();
     $content = curl_exec($this->handle);
     $end = Time::ms();
     $this->lastExecTime = $end - $begin;
     if (curl_errno($this->handle)) {
         Logger::error('library', $this->error());
         return false;
     }
     return $content;
 }
예제 #2
0
 /**
  * 监控信息
  *
  * @param   string  $msg    记录的消息
  */
 public static function p($msg)
 {
     if (!GlobalConfig::$DEBUG_ENABLE) {
         return;
     }
     if (empty(self::$firstTime)) {
         self::$firstTime = Time::ms();
         $debugInfo = array('msg' => '初始化', 'time' => date('Y-m-d H:i:s', time()));
         self::$debugList[] = $debugInfo;
     }
     $time = sprintf('%.2lf', Time::ms() - self::$firstTime);
     $debugInfo = array('msg' => $msg, 'time' => $time . 'MS');
     self::$debugList[] = $debugInfo;
 }
예제 #3
0
 private static function makeKey($id, $ext)
 {
     $cdnKey = date('Ymd', time()) . '/' . Time::ms() . '-' . sprintf('%06d', rand() % 100000) . '-' . sprintf('%011d', $id * 3 + 1) . (empty($ext) ? '' : '.' . $ext);
     return $cdnKey;
 }
예제 #4
0
 private static function makeTicket()
 {
     $ticket = md5(Http::getClientIp() . Time::ms() . uniqid());
     return $ticket;
 }