本文整理汇总了PHP中Dumper::fetchLiveData方法的典型用法代码示例。如果您正苦于以下问题:PHP Dumper::fetchLiveData方法的具体用法?PHP Dumper::fetchLiveData怎么用?PHP Dumper::fetchLiveData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dumper
的用法示例。
在下文中一共展示了Dumper::fetchLiveData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders debug bar.
* @return void
*/
public function render()
{
$useSession = $this->dispatched && session_status() === PHP_SESSION_ACTIVE;
$redirectQueue =& $_SESSION['_tracy']['redirect'];
if (!Helpers::isHtmlMode() && !Helpers::isAjax()) {
return;
} elseif (Helpers::isAjax()) {
$rows[] = (object) ['type' => 'ajax', 'panels' => $this->renderPanels('-ajax')];
$dumps = Dumper::fetchLiveData();
$contentId = $useSession ? $_SERVER['HTTP_X_TRACY_AJAX'] . '-ajax' : NULL;
} elseif (preg_match('#^Location:#im', implode("\n", headers_list()))) {
// redirect
$redirectQueue = array_slice((array) $redirectQueue, -10);
Dumper::fetchLiveData();
Dumper::$livePrefix = count($redirectQueue) . 'p';
$redirectQueue[] = ['panels' => $this->renderPanels('-r' . count($redirectQueue)), 'dumps' => Dumper::fetchLiveData()];
return;
} else {
$rows[] = (object) ['type' => 'main', 'panels' => $this->renderPanels()];
$dumps = Dumper::fetchLiveData();
foreach (array_reverse((array) $redirectQueue) as $info) {
$rows[] = (object) ['type' => 'redirect', 'panels' => $info['panels']];
$dumps += $info['dumps'];
}
$redirectQueue = NULL;
$contentId = $useSession ? substr(md5(uniqid('', TRUE)), 0, 10) : NULL;
}
ob_start(function () {
});
require __DIR__ . '/assets/Bar/panels.phtml';
require __DIR__ . '/assets/Bar/bar.phtml';
$content = Helpers::fixEncoding(ob_get_clean());
if ($contentId) {
$queue =& $_SESSION['_tracy']['bar'];
$queue = array_slice(array_filter((array) $queue), -5, NULL, TRUE);
$queue[$contentId] = ['content' => $content, 'dumps' => $dumps];
}
if (Helpers::isHtmlMode()) {
$stopXdebug = extension_loaded('xdebug') ? ['XDEBUG_SESSION_STOP' => 1, 'XDEBUG_PROFILE' => 0, 'XDEBUG_TRACE' => 0] : [];
$path = isset($_SERVER['REQUEST_URI']) ? explode('?', $_SERVER['REQUEST_URI'])[0] : '/';
$lpath = strtolower($path);
$script = isset($_SERVER['SCRIPT_NAME']) ? strtolower($_SERVER['SCRIPT_NAME']) : '';
if ($lpath !== $script) {
$max = min(strlen($lpath), strlen($script));
for ($i = 0; $i < $max && $lpath[$i] === $script[$i]; $i++) {
}
$path = $i ? substr($path, 0, strrpos($path, '/', $i - strlen($path) - 1) + 1) : '/';
$cookiePath = session_get_cookie_params()['path'];
if (substr($cookiePath, 0, strlen($path)) === $path) {
$path = rtrim($cookiePath, '/') . '/';
}
}
require __DIR__ . '/assets/Bar/loader.phtml';
}
}
示例2: render
/**
* Renders blue screen.
* @param \Exception|\Throwable
* @return void
*/
public function render($exception)
{
if (Helpers::isAjax() && session_status() === PHP_SESSION_ACTIVE) {
ob_start(function () {
});
$this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/content.phtml');
$contentId = $_SERVER['HTTP_X_TRACY_AJAX'];
$_SESSION['_tracy']['bluescreen'][$contentId] = ['content' => ob_get_clean(), 'dumps' => Dumper::fetchLiveData(), 'time' => time()];
} else {
$this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/page.phtml');
}
}
示例3: render
/**
* Renders debug bar.
* @return void
*/
public function render()
{
@session_start();
// @ session may be already started or it is not possible to start session
$session =& $_SESSION['__NF']['tracybar-2.3'];
$redirect = preg_match('#^Location:#im', implode("\n", headers_list()));
if ($redirect) {
Dumper::fetchLiveData();
Dumper::$livePrefix = count($session) . 'p';
}
$obLevel = ob_get_level();
$panels = array();
foreach ($this->panels as $id => $panel) {
$idHtml = preg_replace('#[^a-z0-9]+#i', '-', $id);
try {
$tab = (string) $panel->getTab();
$panelHtml = $tab ? (string) $panel->getPanel() : NULL;
if ($tab && $panel instanceof \Nette\Diagnostics\IBarPanel) {
$panelHtml = preg_replace('~(["\'.\\s#])nette-(debug|inner|collapsed|toggle|toggle-collapsed)(["\'\\s])~', '$1tracy-$2$3', $panelHtml);
$panelHtml = str_replace('tracy-toggle-collapsed', 'tracy-toggle tracy-collapsed', $panelHtml);
}
$panels[] = array('id' => $idHtml, 'tab' => $tab, 'panel' => $panelHtml);
} catch (\Throwable $e) {
} catch (\Exception $e) {
}
if (isset($e)) {
$panels[] = array('id' => "error-{$idHtml}", 'tab' => "Error in {$id}", 'panel' => '<h1>Error: ' . $id . '</h1><div class="tracy-inner">' . nl2br(htmlSpecialChars($e, ENT_IGNORE, 'UTF-8')) . '</div>');
while (ob_get_level() > $obLevel) {
// restore ob-level if broken
ob_end_clean();
}
}
}
if ($redirect) {
$session[] = array('panels' => $panels, 'liveData' => Dumper::fetchLiveData());
return;
}
$liveData = Dumper::fetchLiveData();
foreach (array_reverse((array) $session) as $reqId => $info) {
$panels[] = array('tab' => '<span title="Previous request before redirect">previous</span>', 'panel' => NULL, 'previous' => TRUE);
foreach ($info['panels'] as $panel) {
$panel['id'] .= '-' . $reqId;
$panels[] = $panel;
}
$liveData += $info['liveData'];
}
$session = NULL;
require __DIR__ . '/assets/Bar/bar.phtml';
}
示例4: render
/**
* Renders debug bar.
* @return void
*/
public function render()
{
$useSession = $this->useSession && session_status() === PHP_SESSION_ACTIVE;
$redirectQueue =& $_SESSION['_tracy']['redirect'];
foreach (['bar', 'redirect', 'bluescreen'] as $key) {
$queue =& $_SESSION['_tracy'][$key];
$queue = array_slice((array) $queue, -10, NULL, TRUE);
$queue = array_filter($queue, function ($item) {
return isset($item['time']) && $item['time'] > time() - 60;
});
}
if (!Helpers::isHtmlMode() && !Helpers::isAjax()) {
return;
} elseif (Helpers::isAjax()) {
$rows[] = (object) ['type' => 'ajax', 'panels' => $this->renderPanels('-ajax')];
$dumps = Dumper::fetchLiveData();
$contentId = $useSession ? $_SERVER['HTTP_X_TRACY_AJAX'] . '-ajax' : NULL;
} elseif (preg_match('#^Location:#im', implode("\n", headers_list()))) {
// redirect
Dumper::fetchLiveData();
Dumper::$livePrefix = count($redirectQueue) . 'p';
$redirectQueue[] = ['panels' => $this->renderPanels('-r' . count($redirectQueue)), 'dumps' => Dumper::fetchLiveData(), 'time' => time()];
return;
} else {
$rows[] = (object) ['type' => 'main', 'panels' => $this->renderPanels()];
$dumps = Dumper::fetchLiveData();
foreach (array_reverse((array) $redirectQueue) as $info) {
$rows[] = (object) ['type' => 'redirect', 'panels' => $info['panels']];
$dumps += $info['dumps'];
}
$redirectQueue = NULL;
$contentId = $useSession ? substr(md5(uniqid('', TRUE)), 0, 10) : NULL;
}
ob_start(function () {
});
require __DIR__ . '/assets/Bar/panels.phtml';
require __DIR__ . '/assets/Bar/bar.phtml';
$content = Helpers::fixEncoding(ob_get_clean());
if ($contentId) {
$_SESSION['_tracy']['bar'][$contentId] = ['content' => $content, 'dumps' => $dumps, 'time' => time()];
}
if (Helpers::isHtmlMode()) {
require __DIR__ . '/assets/Bar/loader.phtml';
}
}