本文整理汇总了PHP中Output::render404方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::render404方法的具体用法?PHP Output::render404怎么用?PHP Output::render404使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::render404方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateRequest
/**
* Validates a given API request as being sent from origin via request signature
*
* @param string $body
*
* @return void
*/
private function validateRequest($request)
{
$token = $request['requestToken'];
unset($request['requestToken']);
if ($token === OriginAPI::generateSignedRequest(http_build_query($request))) {
return;
}
Output::render404();
}
示例2: handleOriginResponse
/**
* Handles a response from Origin, generally the last item in the lifecycle of a request
*
* @param mixed $response
*
* @return void
*/
private function handleOriginResponse($response)
{
/**
* Origin didn't have the object
*/
if ($response === false) {
\Output::render404();
}
/**
* We're good to go, start rendering
*/
\Output::sendHeader($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
/**
* Origin had the object, and it's now stored on disk, render the stored object
*/
if ($response === true) {
if (isset($_COOKIE['is_redirecting']) === true) {
sleep(2);
}
\setcookie('is_redirecting', 1, time() + 5);
\Output::sendHeader('Location: ' . $this->request['path']);
$this->isRedirect = true;
}
if (is_object($response) === true) {
/**
* It's a streaming object, so we'll render it from here
*/
\Output::sendHeader($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
\Output::render(\Output::decodeWireObject($response->object));
}
}