Skip to content

Instantly share code, notes, and snippets.

@mmohiudd
Created July 12, 2012 17:03
Show Gist options
  • Save mmohiudd/3099337 to your computer and use it in GitHub Desktop.
Save mmohiudd/3099337 to your computer and use it in GitHub Desktop.
$_REQUEST variable for Kohana
class Controller_Home extends Controller {
protected $args; // store GET/POST variables
public function before() {
parent::before();
// if a GET request
if( $this->request->method() == "GET" ) {
$this->args = $this->request->query();
} else {
$this->args = $this->request->post();
}
}
public function action_index() {
$my_var = isset( $this->args['my_var'] ) ? $this->args['my_var'] : NULL;
echo $my_var;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment