如何在Kohana 3.2中使用锚标记从视图到控制器获取GET参数

时间:2014-03-25 12:14:37

标签: get kohana-3.2

我有一个锚点:

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

Wenn,我在锚标签上发出了这个电话" admin"控制器" supm_find"行动和"页面"和#34;选择" 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"

如何获得这些值?

1 个答案:

答案 0 :(得分:0)

这应该有效:

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

$ this-> request-> post()对$ _POST数组进行操作,

$ this-> request-> query()对$ _GET数组进行操作

$ this-> request-> param()在kohana route params上运行

您可以在此处阅读更多内容:http://kohanaframework.org/3.1/guide/api/Request