我正在尝试在同一模型读取数据后保存数据。这是我的代码:
public function partner($postid, $partner){
$this->Partner->id = $postid;
$this->Partner->id = $partner;
$this->Partner->ip = $_SERVER['REMOTE_ADDR'];
$result = $this->Partner->read();
if($result){
$time = $result['Partner']['time'];
pr($result);
}
$data = array('id' => $partner,
'post' => $postid,
'time' => time(),
'cash' => '0.001',
'ip' => $_SERVER['REMOTE_ADDR']);
$this->Partner->save($data);
}
它只是更新数据,但不会将其保存为新行