有没有办法在通过Restler实现数据验证阶段之前记录收到的POST请求数据?
答案 0 :(得分:2)
使用onValidate事件,它在验证开始之前触发
//in your index.php after $r = new Restler()
$r->onValidate(function() use ($r){
Logger::log($r->getRequestData());
}
答案 1 :(得分:0)
将它们复制到变量,并验证变量中的值:'
$my_post = $_POST;
//consider we want to validate some query-parameter called q
if(isset($my_post['q']) && ! empty($my_post['p'])) {
//do something
}