When editing, the content is not modified, the submission always prompts failure, how to fix it

  How to tell if an update operation was successful

$Model = D('Blog');
$data['id'] = 10;
$data['name'] = 'update name';
$result = $Model->save($data);
if ( false !== $result ){
    $this->success('Update succeeded!');
}else{
    $this->error('Update failed!');
}

    need to use! == false to judge whether the update is successful, because the return value of the save method is the number of records affected by the update operation. The number of records that may be affected is 0, but the update is successful.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326208046&siteId=291194637