Cakephp 如何访问和获取参数?

Cakephp 如何访问和获取参数?,cakephp,Cakephp,这里是cakephp版本cakephp-2.4.5中搜索功能的代码,当我请求搜索$this->request->isGet{执行并且$keyword值变为空时,,,这里我如何在这里获取参数删除此编码 public function search() { $this->Paginator->settings = $this->paginate; $this->loadmodel('Usermgmt.User'); if ($this->request

这里是cakephp版本cakephp-2.4.5中搜索功能的代码,当我请求搜索$this->request->isGet{执行并且$keyword值变为空时,,,这里我如何在这里获取参数

删除此编码

public function search() {

$this->Paginator->settings = $this->paginate;



 $this->loadmodel('Usermgmt.User');




if ($this->request -> isGet()) {
        $this->User->set($this->data);
            $keyword=$this->data['Doctors']['search'];

 $cond=array('OR'=>array("User.username LIKE '%$keyword%'","User.email LIKE '%$keyword%'", "User.first_name LIKE '%$keyword%'", "User.last_name LIKE '%$keyword%'", "User.positions LIKE '%$keyword%'"));





 $result = $this->paginate('User',array($cond));

  $this->set('result',$result);



}
如果您使用的是get方法,请添加这个

  $this->User->set($this->data);
            $keyword=$this->data['Doctors']['search'];
此处keyvalue是用户参数名

删除此编码

public function search() {

$this->Paginator->settings = $this->paginate;



 $this->loadmodel('Usermgmt.User');




if ($this->request -> isGet()) {
        $this->User->set($this->data);
            $keyword=$this->data['Doctors']['search'];

 $cond=array('OR'=>array("User.username LIKE '%$keyword%'","User.email LIKE '%$keyword%'", "User.first_name LIKE '%$keyword%'", "User.last_name LIKE '%$keyword%'", "User.positions LIKE '%$keyword%'"));





 $result = $this->paginate('User',array($cond));

  $this->set('result',$result);



}
如果您使用的是get方法,请添加这个

  $this->User->set($this->data);
            $keyword=$this->data['Doctors']['search'];

这里的keyvalue是用户参数名

Thulasi的方法会起作用,但请注意,使用$this->params['url']已被弃用,而使用$this->request->query。因此建议的新方法是:

$keyword = $this->params['url']['keyvalue'];

另请参见本主题。

Thulasi的方法将起作用,但请注意,使用$this->params['url']已被弃用,而使用$this->request->query。因此建议的新方法是:

$keyword = $this->params['url']['keyvalue'];

另请参见本主题。

您的$this->data是否也为空?您的$this->data是否也为空?