使用CakePHP3,我有一个带有GET方法的搜索表单。尝试获取URL参数似乎不起作用。我做如下操作:
if(isset($this->request->params['text'])){
// the code ...
}搜索表单的操作有一个已定义的路由:
$routes->connect('/search', [
'controller' => 'Top',
'action' => 'index'
],
[
'_name' => 'search'
]);如何解决这个问题?
发布于 2016-07-27 13:18:50
您可以这样做:获取查询字符串($_GET)参数
if(isset($this->request->query['text'])){
// the code ...
}发布于 2016-09-14 13:16:47
我认为你正在寻找这个:
$this->request->query('text');参考:http://book.cakephp.org/3.0/en/controllers/request-response.html#query-string-parameters
https://stackoverflow.com/questions/38598853
复制相似问题