如何在Cakephp中保存特定字段

hel*_*ikh 5 cakephp cakephp-2.0 cakephp-2.1

这是我的代码

public function settings(){
$this->loadModel('Userinfo');

    $helpers = array('TimeZoneHelper');
    if($this->request->is('post')) {
        $id = $this->Auth->User('idUser');


 $data =  $this->request->data['Userinfo']['timezone'];
 $this->Userinfo->save($data,array(
     'conditions' => array('Userinfo.User_id' => $id))));

}
Run Code Online (Sandbox Code Playgroud)

我在我的userinfo表中有一个字段名称时区 ..我想要更新..我不知道我怎么能专门更新Cakephp中的单个字段,因为我是Cakephp中的新功能..我这样做但不知道为什么它不是工作......当我调试$ data时 ......数据很好..在数据库中,时区的数据类型是"时间"

jmc*_*jmc 9

设置模型ID:

$this->Userinfo->id = $id;

然后,使用savefield函数保存特定字段:

$this->Userinfo->saveField('timezone', 'UTC');

祝CakePhp好运!