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());
}

 

posted @ 2018-04-15 19:26  我是谁,我在做什么  阅读(214)  评论(0编辑  收藏  举报