Skip to content

Instantly share code, notes, and snippets.

@ThePixelDeveloper
Created January 24, 2010 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThePixelDeveloper/285377 to your computer and use it in GitHub Desktop.
Save ThePixelDeveloper/285377 to your computer and use it in GitHub Desktop.
<?php
// HTTP request
$request = Request::instance();
try
{
$request->execute();
}
/**
* HTTP error exception
*/
catch (Kohana_HTTP_Exception $e)
{
$request->response = $e->getMessage().'[ '.$e->getCode().' ]';
}
// HTTP response
$response = $request->send_headers()->response;
<?php
class Controller_Example extends Controller
{
public function action_index()
{
// Set status to 404 and throw http_exception
throw new Kohana_HTTP_Exception('This action doesn\'t exist', NULL, 404);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment