RequestService (since version 2.0)
Type Service
Methods
Description
The request service is used to retrieve request parameters an cache them for retrieving calls.
The request service holds the available parameters in different containers.
The GET and POST parameters are available also params.
Available containers are: controller, action, params, GET, POST and FILES
Note:
As default the first pair in an URL represents the controller and action.
You can add routes to modify the URL representation and handling.
This service uses the UriService for parsing the request parameters to array values.
The request service holds the available parameters in different containers.
The GET and POST parameters are available also params.
Available containers are: controller, action, params, GET, POST and FILES
Note:
As default the first pair in an URL represents the controller and action.
You can add routes to modify the URL representation and handling.
This service uses the UriService for parsing the request parameters to array values.
Examples
<?php
// URL http://domain.com/page/index/target/user/id/10
// retrieve the controller name
$controller = RequestService::GetRequestKey('controller');
// retrieve the action name
$action = RequestService::GetRequestKey('action');
// retrieve the target value
$target = RequestService::GetRequestParamKey('target');
// retrieve the id value
$id = RequestService::GetRequestParamKey('id');
var_dump($controller);
var_dump($action);
var_dump($target);
var_dump($id);
?>
Output:
(string) "page"
(string) "index"
(string) "user"
(int) 10
// URL http://domain.com/page/index/target/user/id/10
// retrieve the controller name
$controller = RequestService::GetRequestKey('controller');
// retrieve the action name
$action = RequestService::GetRequestKey('action');
// retrieve the target value
$target = RequestService::GetRequestParamKey('target');
// retrieve the id value
$id = RequestService::GetRequestParamKey('id');
var_dump($controller);
var_dump($action);
var_dump($target);
var_dump($id);
?>
Output:
(string) "page"
(string) "index"
(string) "user"
(int) 10
Last change 10/16/2009