$whatever
$whatever : mixed
API parmas
PhalApi Api Class
-
Generally, class can extend PhalApi_Api like:
class Api_Demo extends PhalApi_Api {
public function getRules() {
return array(
// ...
);
}
public function doSth() {
$rs = array();
// ...
return $rs;
}
}
getApiRules() : array
Get all API rules
mainly composed of:
service
paramapp.apiCommonRules
*
of API classNOTE: The priority of rules: 1 < 2 < 3 < 4. Otherwise both request method name and config indexes will trans into lowercase before being compared with others.
filterCheck()
Exec filter
This is a simple example as below:
class My_Filter implements PhalApi_Filter {
public function check() {
//TODO
}
}
// register DI()->filter in the file init.php
DI()->filter = 'My_Filter';
throw 400 exception when fail to check