# Update 更新数据 > update($data, $where) 中文 : 更新(数据,条件) data [array] 修改的数据. WHERE 条件.[可选] Return: [number] 受影响的行数. ~~~ $User = M("User"); $User->update(array( "type" => "user", // age字段的值 + 1 "age[+]" => 1, // 减 - 5 "level[-]" => 5, // 两倍 2 "score[*]" => 2, // SQL 函数 "#uid" => "UUID()" ), array( "user_id[<]" => 1000 )); ~~~ 将 用户名user 等于 admin的用户密码修改为 123 ~~~ <?php namespace Action; use HY\Action; class Index extends Action { public function Index(){ //实例User表为对象 $User = M("User"); $User->update( array( "pass" => "123", ), array( 'user'=>'admin' ) ); //中文 $User->更新( array( "pass" => "123", ), array( 'user'=>'admin' ) ); } } ~~~