本文整理汇总了PHP中sfException::getLastException方法的典型用法代码示例。如果您正苦于以下问题:PHP sfException::getLastException方法的具体用法?PHP sfException::getLastException怎么用?PHP sfException::getLastException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfException
的用法示例。
在下文中一共展示了sfException::getLastException方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debug
/**
* Outputs some debug information about the current response.
*
* @param string $realOutput Whether to display the actual content of the response when an error occurred
* or the exception message and the stack trace to ease debugging
*/
public function debug($realOutput = false)
{
print $this->tester->error('Response debug');
if (!$realOutput && null !== sfException::getLastException())
{
// print the exception and the stack trace instead of the "normal" output
$this->tester->comment('WARNING');
$this->tester->comment('An error occurred when processing this request.');
$this->tester->comment('The real response content has been replaced with the exception message to ease debugging.');
}
printf("HTTP/1.X %s\n", $this->response->getStatusCode());
foreach ($this->response->getHttpHeaders() as $name => $value)
{
printf("%s: %s\n", $name, $value);
}
foreach ($this->response->getCookies() as $cookie)
{
vprintf("Set-Cookie: %s=%s; %spath=%s%s%s%s\n", array(
$cookie['name'],
$cookie['value'],
null === $cookie['expire'] ? '' : sprintf('expires=%s; ', date('D d-M-Y H:i:s T', $cookie['expire'])),
$cookie['path'],
$cookie['domain'] ? sprintf('; domain=%s', $cookie['domain']) : '',
$cookie['secure'] ? '; secure' : '',
$cookie['httpOnly'] ? '; HttpOnly' : '',
));
}
echo "\n";
if (!$realOutput && null !== $exception = sfException::getLastException())
{
echo $exception;
}
else
{
echo $this->response->getContent();
}
echo "\n";
}