Skip to main content

Application::in

Get request data (POST/GET)

Description

public void Application::in( [ string $name = "" ], [ type $method = "" ] )

Get request data that automatically converted single/double quote and character code.

Arguments

NameData typeDefaultRemarks
$namestring""Request param key
$methodstring""null or POST or GET

Example

Controller - GET
// http://example.com/?foo=get

echo $this->in('foo'); // -> get
echo $this->in('foo', 'get'); // -> get
echo $this->in('foo', 'post'); // -> NULL
Controller - POST
// http://example.com/ : POST('foo' => 'post')

echo $this->in('foo'); // -> post
echo $this->in('foo', 'get'); // -> NULL
echo $this->in('foo', 'post'); // -> post

If POST and GET have same name arguments, POST is priority than GET.

Controller - GET and POST
// http://example.com/?foo=get : POST('foo' => 'post')

echo $this->in('foo'); // -> post
echo $this->in('foo', 'get'); // -> get
echo $this->in('foo', 'post'); // -> post

You can get all request data when omit a first argument.

Controller
// http://example.com/ : POST('foo' => 'bar', 'baz' => 'qux')

var_dump( $this->in() );
Output
array(2) { ["foo"]=> string(3) "bar" ["baz"]=> string(3) "qux" }