thinkphp5 模型的 更新操作

public function index()
{
  $ad = new Destoon_ad();
  $data=[
  'url'=>'www.baidu.com',
  'pid'=>'6666'

];
$where = ['aid'=>1];
$ad->save($data,$where);
dump($ad->getData());
}

静态更新

public function index()
{
  //update(更新数据,更新条件,允许更新字段)
  $data = [
  'pid'=>888,'url'=>'www.888.com'
  ];
  $where = ['aid'=>1];
  $field = ['pid','url'];
  $result = Destoon_ad::update($data,$where,$field);
  dump($result->getData());
}

原文地址:https://www.cnblogs.com/my2018/p/8849051.html