RequestHandler
The
RequestHandler class is intended to easily access the REQUEST content. Therefore,
the component uses the
$_REQUEST array, that was already treated by an
input filter
at the time of usage. This makes the access safer.
The application of the static class looks as follows:
PHP-Code
// get a single request value
$value = RequestHandler::getValue('foo','bar');
// define a param array with default values
$params = array('foo' => 'bar','baz');
$values = RequestHandler::getValues($params);
// get several values
The
$value variable does contain the value of the request param
foo. If the
param is not contained in the URL, the value is
bar. The array
$values
contains the value of the param
foo within one offset, the offset
baz includes the
corresponding request value. In case the
foo param is not found in the request, the default
value is set to
bar. If the
baz param is not found,
null is returned
in that offset. Further details can be taken from the API documentation.
In order to use the component, it must be included using
PHP-Code
import('tools::request','RequestHandler');
Comments
Do you want to add a comment to the article above, or do you want to post additional hints? So please click
here. Comments already posted can be found below.
There are no comments belonging to this article.