本文整理匯總了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";
}