0
我的问题看起来很愚蠢,但我需要联系并做出决定。我想将参数传递给url,而不需要在url中看到参数。这是为了保护我的服务器。由于URL看起来像这样Kohana 3.3获取网址参数
控制器/编辑/ 123
和 '123' 是在数据库中的用户ID。 我可以简单的做到这一点
public function action_edit($id) {
get_db_info($id);
}
是否有可能隐藏参数,同时从视图重定向到这个网址?即在视图文件
// Do something to set the ID
<?php Kohana_Request::post("user_id", $id); ?>
<a href="<?=URL::base()?>controller/edit">Click</a>
,并得到这样
public function action_edit() {
$id = $this->request->post("user_id");
get_db_info($id);
}
但我不能访问KOhana_Request实例,并得到这个错误
*非静态方法的问题Kohana_Request的ID :: post()不应该被称为静态*
有人可以提供一个安全的方法呢?