2014-03-25 33 views
0

我有鉴于锚:如何让摆脱视图PARAMS在Kohana的锚标记控制器3.2

echo HTML::anchor("admin/supm_find?page=".($page+1).'&tselected='.$selected, "Next"); 

德恩,我ckick锚标记,这就是所说的“管理员” contorller与“supm_find”行动和“页”和“选择” PARAMS。

在控制器:

$selected=$this->request->post('selected'); 
$page=$this->request->post('page'); 

但是,两个变量的值是NULL!怎么了? 在错误消息我看到这一点:

SYSPATH\classes\kohana\request\client\internal.php [ 116 ] » ReflectionMethod->invoke(arguments) 

     protected _get => array(2) (
     "page" => string(1) "2" 
     "selected" => string(7) "Wien" 

如何获得这些价值?

回答

0

这应该工作:

$selected=$this->request->query('selected'); 
$page=$this->request->query('page'); 

$这个 - >请求 - >后()在$ _ POST操作阵列,

$这个 - >请求 - >查询()在$ _GET数组操作

$这个 - >请求 - >参数()上的Kohana路线经营PARAMS

你可以在这里阅读更多:http://kohanaframework.org/3.1/guide/api/Request

+0

所以现在它的工作原理。谢谢。 – Vincent