为什么php修改数据无法同步到数据库,只是当前页面修改成功?
问题描述
接口:
public function updateRole($f_name,$u_name,$r_name,$i_name){ $res = Db::table("fa_waem_instrument_info")->field('fa_dms_room.r_name,info.i_name,fa_dms_unit.u_name,info.i_type,fa_dms_floor.f_name')->alias('info')->join('fa_dms_room ', 'info.room_id = fa_dms_room.id ')->join('fa_dms_unit ', ' fa_dms_room.id = fa_dms_unit.id')->join('fa_dms_floor ', ' fa_dms_unit.id = fa_dms_floor.id ')->where('f_name',$f_name)->update(['r_name'=>+$r_name,'f_name'=>$f_name,'u_name'=>$u_name,'i_name'=>$i_name]); $this->success("修改",$res);}
前端:
submit: function () { console.log("修改为:", this.item) this.axios.get("Waterelectricity/updateRole?f_name=" + this.item.f_name + "&r_name=" + this.item.r_name+ "&u_name=" + this.item.u_name+ "&i_name=" + this.item.i_name).then(res => {console.log("修改---", res)this.show = false; })},
问题解答
回答1:update([’r_name’=>+$r_name,’f_name’=>$f_name,’u_name’=>$u_name,’i_name’=>$i_name]);多了一个“+”号