本文整理汇总了PHP中HTTP::isSent方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::isSent方法的具体用法?PHP HTTP::isSent怎么用?PHP HTTP::isSent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::isSent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
/**
* Log a message.
*
* @param array $args
*/
public function write($args)
{
unset($args['type']);
$filename = null;
$linenum = null;
if (HTTP::isSent($filename, $linenum)) {
trigger_error("Headers already sent in {$filename} on line {$linenum}. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.", E_USER_NOTICE);
return;
}
try {
if (!self::initConsole()) {
return;
}
$values = array_merge($this->_eventValues->getAll(), isset($type) ? array('type' => $type) : array(), is_array($message) ? $message : array('message' => $message));
if (!isset($this->columns)) {
$this->columns = array_combine(array_keys($values), array_map('ucfirst', array_keys(array_change_key_case($values, CASE_LOWER))));
}
foreach (array_keys($this->columns) as $col) {
$row[] = isset($values[$col]) ? $values[$col] : null;
}
if ($this->unique_counter == 0) {
HTTP::setHeader("X-FirePHP-Data-{$this->unique_base}00000000", "[\"{$this->title}\",");
self::sendMessage(json_encode(array_values($this->columns)), $this->unique_base, $this->unique_counter);
HTTP::setHeader("X-FirePHP-Data-{$this->unique_base}99999999", "]");
}
self::sendMessage(json_encode($row), $this->unique_base, $this->unique_counter);
} catch (\Exception $e) {
trigger_error("An exception occured while writing a row to a FirePHP table.\n" . (string) $e, E_USER_WARNING);
}
}
示例2: fbDump
/**
* Send variable dump to the client
*
* @param string $key
* @param mixed $variable
* @return boolean
*/
public static function fbDump($key, $variable)
{
if (!self::detectClientExtension()) {
return false;
}
if ($key == 'FirePHP.Firebug.Console') {
$key = "_right_";
}
$filename = '';
$linenum = 0;
if (HTTP::isSent($filename, $linenum)) {
trigger_error("Headers already sent in {$filename} on line {$linenum}. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.", E_USER_NOTICE);
return false;
}
HTTP::setHeader('X-FirePHP-Data-100000000001', '{');
HTTP::setHeader('X-FirePHP-Data-200000000001', '"FirePHP.Dump":{');
HTTP::setHeader('X-FirePHP-Data-2' . str_pad(++self::$counter, 11, '0', STR_PAD_LEFT), '"' . $key . '":' . json_encode($variable) . ',');
HTTP::setHeader('X-FirePHP-Data-299999999999', '"__SKIP__":"__SKIP__"},');
HTTP::setHeader('X-FirePHP-Data-999999999999', '"__SKIP__":"__SKIP__"}');
return true;
}