本文整理汇总了PHP中Output::status方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::status方法的具体用法?PHP Output::status怎么用?PHP Output::status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response
protected function response($data = array(), $http_code = 200)
{
if (empty($data))
{
\Output::$status = 404;
return;
}
\Output::$status = $http_code;
// If the format method exists, call and return the output in that format
if (method_exists('Controller_Rest', '_format_'.$this->request->format))
{
// Set the correct format header
\Output::set_header('Content-Type', $this->_supported_formats[$this->request->format]);
$this->output = $this->{'_format_'.$this->request->format}($data);
}
// Format not supported, output directly
else
{
$this->output = (string) $data;
}
}
示例2: action_404
public function action_404()
{
$messages = array('Aw, crap!', 'Bloody Hell!', 'Uh Oh!', 'Nope, not here.', 'Huh?');
$data['title'] = $messages[array_rand($messages)];
// Set a HTTP 404 output header
Output::$status = 404;
$this->render('welcome/404', $data);
}
示例3: show_404
/**
* Shows a 404. Checks to see if a 404_override route is set, if not show
* a default 404.
*
* Usage:
*
* <code>Request::show_404();</code>
*
* @access public
* @return void
*/
public static function show_404($return = false)
{
logger(Fuel::L_INFO, 'Called', __METHOD__);
\Output::$status = 404;
if (\Config::get('routes.404') === null) {
static::active()->output = \View::factory('404');
} else {
list($controller, $action) = array_pad(explode('/', \Config::get('routes.404')), 2, false);
$action or $action = 'index';
$class = '\\Controller_' . ucfirst($controller);
$method = 'action_' . $action;
if (class_exists($class)) {
$controller = new $class(static::active());
if (method_exists($controller, $method)) {
// Call the before method if it exists
if (method_exists($controller, 'before')) {
$controller->before();
}
$controller->{$method}();
// Call the after method if it exists
if (method_exists($controller, 'after')) {
$controller->after();
}
// Get the controller's output
if ($return) {
return $controller->output;
}
exit($controller->output);
} else {
throw new \Exception('404 Action not found.');
}
} else {
throw new \Exception('404 Controller not found.');
}
}
}
示例4: action_404
public function action_404()
{
// Set a HTTP 404 output header
Output::$status = 404;
$this->render('welcome/404');
}