码迷,mamicode.com
首页 > Web开发 > 详细

thinkphp5 模型的 更新操作

时间:2018-04-15 21:02:32      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:技术   public   bsp   baidu   .com   更新字段   think   静态   允许   

技术分享图片

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

 

thinkphp5 模型的 更新操作

标签:技术   public   bsp   baidu   .com   更新字段   think   静态   允许   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!