如何在CakePHP中将数据从表单传递到控制器?

如何在CakePHP中将数据从表单传递到控制器?,cakephp,Cakephp,如何将表单中的数据传递给控制器,然后将数据传递给模型 public function registertest() { if (!empty($this->data)) { var_dump($this->data); if ($this->data['User']['password'] == $this->Auth->password($this->data['User']['cpassword']))

如何将表单中的数据传递给控制器,然后将数据传递给模型

public function registertest()
    {

    if (!empty($this->data)) {

        var_dump($this->data);

        if ($this->data['User']['password'] == $this->Auth->password($this->data['User']['cpassword'])) {
            $this->User->create();

            if($this->User->save($this->data)) {
                $this->Auth->login($this->data);
                $this->redirect(array('action' => 'index'));
            }
        }
    }
    //$this->render('register');
}
使用此代码

 public function registertest()
    {
    if ($this->request->is('post')) {
       $this->data['User']['password'] == $this->Auth->password($this->data['User']['cpassword']);
       $this->User->create();

        if($this->User->save($this->request->data['User'])) {
            $this->Auth->login($this->request->data['User']);

            $msg = '<div class="alert alert-success">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <strong> User Created succeesfully </strong>
            </div>';
            $this->Session->setFlash($msg);
            $this->redirect(array('action' => 'index'));
        }



        }
}
公共函数寄存器测试()
{
如果($this->request->is('post')){
$this->data['User']['password']==$this->Auth->password($this->data['User']['cpassword']);
$this->User->create();
如果($this->User->save($this->request->data['User'])){
$this->Auth->login($this->request->data['User']);
$msg='1
&时代;
用户创建成功
';
$this->Session->setFlash($msg);
$this->redirect(数组('action'=>'index'));
}
}
}
使用此代码

 public function registertest()
    {
    if ($this->request->is('post')) {
       $this->data['User']['password'] == $this->Auth->password($this->data['User']['cpassword']);
       $this->User->create();

        if($this->User->save($this->request->data['User'])) {
            $this->Auth->login($this->request->data['User']);

            $msg = '<div class="alert alert-success">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <strong> User Created succeesfully </strong>
            </div>';
            $this->Session->setFlash($msg);
            $this->redirect(array('action' => 'index'));
        }



        }
}
公共函数寄存器测试()
{
如果($this->request->is('post')){
$this->data['User']['password']==$this->Auth->password($this->data['User']['cpassword']);
$this->User->create();
如果($this->User->save($this->request->data['User'])){
$this->Auth->login($this->request->data['User']);
$msg='1
&时代;
用户创建成功
';
$this->Session->setFlash($msg);
$this->redirect(数组('action'=>'index'));
}
}
}

您需要什么?请解释你做了什么?你需要什么?请解释你做了什么?控制器中不应该有html-这似乎也不能回答问题(不清楚)。控制器中不应该有html-这似乎也不能回答问题(不清楚)。