本文整理汇总了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;
}
示例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;
}
示例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;
}