kohana 3.2$this->request->param()
和in有什么区别?$this->request->post()
有人简要解释一下。
谢谢
假设您有这样的 URL:http ://example.com/store/books/computer/martin_fowler ,路由定义如下:
Route::set('books', '<controller>/<action>(/<product>(/<category>(/<author>)))')
->defaults(array(
'controller' => 'store',
'action' => '',
));
$this->request->param()
这将返回:
array (
'product' => 'books',
'category' => 'computer',
'author' => 'martin_fowler',
)
$this->request->post()
将返回$_POST
数据。
如果未找到密钥,这两种方法都将返回 NULL:
$this->request->param('xxx') // NULL
$this->request->param('author') // martin_fowler
$this->request->post('id') // Some id value in $_POST or NULL if id doesn't exist in $_POST
位于科哈纳
$data = $this->request->post();
// get $_POST data
返回提交表单等发布数据。
$this->request->param()
返回发布的数据以及从 $_POST 和 $_GET 发送的数据。
Param 在路由过程之后获取分配给请求的请求参数,而 post 获取原始数据 POST。