private function render($controller, $is404 = false) { $response = thin('response'); if (!$is404) { $response->setStatusCode(200, 'OK'); } else { $response->setStatusCode(404, 'Not Found'); } ob_start(); $response->sendHeaders()->setContent($this->html($controller))->send(); $html = ob_get_contents(); ob_end_clean(); die($html . '<!-- generated in ' . Timer::get() . ' s. -->'); }
public static function is404() { $response = thin('response'); $response->setStatusCode(404, 'Not Found')->sendHeaders()->setContent(Config::get('app.notFound', '<h1>Erreur 404</h1>'))->send(); exit; }
public function is404() { header('content-type: text/html; charset=utf-8'); $response = thin('response'); $response->setStatusCode(404, 'Not Found')->sendHeaders()->setContent('<h1>Page not found</h1>')->send(); exit; }
private static function render($html) { $response = thin('response'); $response->setStatusCode(200, 'OK')->sendHeaders()->setContent($html)->send(); exit; }
function response($message = '', $code = 200, array $headers = []) { $statuses = array(100 => 'Continue', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'unused', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Authorization Required', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 419 => 'unused', 420 => 'unused', 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'No code', 426 => 'Upgrade Required', 500 => 'Internal Server Error', 501 => 'Method Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Temporarily Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 509 => 'Bandwidth Limit Exceeded', 510 => 'Not Extended', 511 => 'Network Authentication Required'); $status = isset($statuses[$code]) ? $statuses[$code] : 'OK'; thin('response')->setStatusCode($code, $status)->sendHeaders($headers)->setContent($message)->send(); exit; }
private static function is404() { $response = thin('response'); $response->setStatusCode(404, 'Not Found')->sendHeaders()->setContent('Page not found')->send(); exit; }
public static function di($service = null) { return thin($service); }