$data
$data : array
Request Class
__construct(array $data = NULL)
- 如果需要定制已知的数据源(即已有数据成员),则可重载此方法,例
class My_Request extend PhalApi_Request{
public function __construct($data = NULL) {
parent::__construct($data);
// handle json
$this->post = json_decode(file_get_contents('php://input'), TRUE);
// handle xml
$this->post = simplexml_load_string (
file_get_contents('php://input'),
'SimpleXMLElement',
LIBXML_NOCDATA
);
$this->post = json_decode(json_encode($this->post), TRUE);
}
}
array | $data | 参数来源,可以为:$_GET/$_POST/$_REQUEST/自定义 |
getByRule(array $rule) : mixed
Get parameter by rule
build the pramater with rule, and reutrn error message when fail
array | $rule | rule, such as: |
getDataBySource( $source) : array
Get data by source ``` |----------|---------------------| | post | $_POST | | get | $_GET | | cookie | $_COOKIE | | server | $_SERVER | | request | $_REQUEST | | header | $_SERVER['HTTP_X'] | |----------|---------------------|
Override this function if you need to get data from other source
$source |