2014-03-25 34 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