当前位置: 首页>>代码示例>>PHP>>正文


PHP Debugger::add方法代码示例

本文整理汇总了PHP中Debugger::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::add方法的具体用法?PHP Debugger::add怎么用?PHP Debugger::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Debugger的用法示例。


在下文中一共展示了Debugger::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: call

 public static function call($method, $url, $data, &$result)
 {
     if (Debugger::$enabled) {
         $time = microtime(true);
     }
     $ch = curl_init();
     if (static::$cookies) {
         $cookieJar = tempnam(sys_get_temp_dir(), "curl_cookies-");
         if (isset($_SESSION['curl_cookies'])) {
             file_put_contents($cookieJar, $_SESSION['curl_cookies']);
         }
         curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieJar);
         curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieJar);
     }
     static::setOptions($ch, $method, $url, $data);
     $result = curl_exec($ch);
     $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     if (Debugger::$enabled) {
         $timing = array();
         $timing['name_lookup'] = curl_getinfo($ch, CURLINFO_NAMELOOKUP_TIME);
         $timing['connect'] = curl_getinfo($ch, CURLINFO_CONNECT_TIME);
         $timing['pre_transfer'] = curl_getinfo($ch, CURLINFO_PRETRANSFER_TIME);
         $timing['start_transfer'] = curl_getinfo($ch, CURLINFO_STARTTRANSFER_TIME);
         $timing['redirect'] = curl_getinfo($ch, CURLINFO_REDIRECT_TIME);
         $timing['total'] = curl_getinfo($ch, CURLINFO_TOTAL_TIME);
     }
     curl_close($ch);
     if (static::$cookies) {
         $_SESSION['curl_cookies'] = file_get_contents($cookieJar);
         unlink($cookieJar);
     } else {
         unset($_SESSION['curl_cookies']);
     }
     if (Debugger::$enabled) {
         $duration = microtime(true) - $time;
         $options = static::$options;
         $headers = static::$headers;
         Debugger::add('api_calls', compact('duration', 'method', 'url', 'data', 'options', 'headers', 'status', 'timing', 'result'));
     }
     return $status;
 }
开发者ID:mehulsbhatt,项目名称:MindaPHP,代码行数:41,代码来源:Curl.php

示例2: set

 public static function set($key, $var, $expire = 0)
 {
     if (Debugger::$enabled) {
         $time = microtime(true);
     }
     if (!static::$memcache) {
         static::initialize();
     }
     $res = static::$memcache->set(static::$prefix . $key, $var, 0, $expire);
     if (Debugger::$enabled) {
         $duration = microtime(true) - $time;
         $command = 'set';
         $arguments = array($key, static::variable($var));
         if ($expire) {
             $arguments[] = $expire;
         }
         $result = static::variable($res);
         Debugger::add('cache', compact('duration', 'command', 'arguments', 'result'));
     }
     return $res;
 }
开发者ID:mehulsbhatt,项目名称:MindaPHP,代码行数:21,代码来源:Cache.php

示例3: selectTyped

 private static function selectTyped($query)
 {
     if (!Debugger::$enabled) {
         return forward_static_call_array('DB::selectTypedInternal', func_get_args());
     }
     $time = microtime(true);
     $result = forward_static_call_array('DB::selectTypedInternal', func_get_args());
     $duration = microtime(true) - $time;
     $arguments = func_get_args();
     if (strtoupper(substr(trim($query), 0, 6)) == 'SELECT') {
         $arguments[0] = 'explain ' . $query;
         $explain = forward_static_call_array('DB::selectTypedInternal', $arguments);
     } else {
         $explain = false;
     }
     $arguments = array_slice(func_get_args(), 2);
     $equery = static::$mysqli->real_escape_string($query);
     Debugger::add('queries', compact('duration', 'query', 'equery', 'arguments', 'result', 'explain'));
     return $result;
 }
开发者ID:mehulsbhatt,项目名称:MindaPHP,代码行数:20,代码来源:DB.php


注:本文中的Debugger::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。