本文整理汇总了PHP中ErrorHandler::getResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::getResponse方法的具体用法?PHP ErrorHandler::getResponse怎么用?PHP ErrorHandler::getResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::getResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled
public function testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled()
{
$original = Settings::getSettings();
$settings = $original;
$settings['errors']['verbose'] = false;
Settings::setFromArray($settings);
try {
$this->request->dispatch("/notfound");
} catch (Exception $e) {
$handler = new ErrorHandler();
$handler->setRequest($this->request);
$handler->handleError($e);
$this->assertResponseCode(404, $handler->getResponse());
$this->assertBodyHasContents("Oops! That’s a 404", $handler->getResponse());
$this->assertBodyHasContents("It looks like the page you’re after doesn’t exist", $handler->getResponse());
}
Settings::setFromArray($original);
}
示例2: getenv
$mode = getenv("PROJECT_MODE") !== false ? getenv("PROJECT_MODE") : "live";
//session_cache_limiter(false);
try {
// make sure a request object is available as soon as possible
$request = JaossRequest::getInstance();
Settings::setMode($mode);
include "library/boot.php";
include "library/load_apps.php";
if (Settings::getValue("date", "allow_from_cookie", false)) {
$date = CookieJar::getInstance()->getCookie("test_date");
if ($date !== null) {
Utils::setCurrentDate($date);
}
}
$request->dispatch();
$response = $request->getResponse();
/*
$response->setIfNoneMatch(
$request->getHeader('If-None-Match')
);
*/
$response->send();
} catch (Exception $e) {
$handler = new ErrorHandler();
$handler->setRequest($request);
$handler->handleError($e);
$response = $handler->getResponse();
$response->send();
} catch (Exception $e) {
exit($e->getMessage());
}