我正在尝试构建一个Facebook
Auth 适配器。在其中,我需要掌握Request
对象以检索请求查询参数。
我在我的插件引导程序中添加了这个:
<?php
use lithium\action\Dispatcher;
use facebook\extensions\adapter\security\auth\Facebook;
Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
//debug(compact('self', 'params', 'chain'));
Facebook::$request = $params['request'];
// Always make sure to keep the filter chain going.
$response = $chain->next($self, $params, $chain);
return $response;
});
然后我可以check()
使用self::$request
. 但这似乎是错误的。
同样的情况,当我尝试重定向我的用户时,我看不到如何访问控制器lithium\action\Controller::redirect()
并且不是静态的。
我是整个过滤器的新手,有人可以告诉我这是正确的实现吗?