public function update(){
$User = M('User');
if ($User->create()) {
$result = $User->save();
if ($result) {
$this->success('Update OK!');
} else {
$this->error($User->getError());
}
} else {
$this->error($User->getError());
}
}来来回回看了半天,莫非 $result 有问题,仔细 dump 出来看看。结果,如果记录集中有东西被 update,则 $result 有值,如果要 Update 的东西跟原值一样,也就是保持原样, $result 是假的。是0 ? 看文档说 save返回的是受影响的行数。 最佳答案