摘要:
方法 public function index() { $ad = Destoon_ad::get(2); return $ad->totime; } 模型下创建读取器 protected function getTotimeAttr($totime){ return date('Y-m-d',$ 阅读全文
摘要:
delete()方法 $result = Destoon_ad::get(['aid'=>['=',17]]); dump($result->delete()); destroy()方法 public function index() { $where = function($query){ $qu 阅读全文
摘要:
public function index() { //模型实列化调用get()和find()方法 $ad = new Destoon_ad; $where = function($query){ $query->field(['pid','url'])->where('aid',1); }; $r 阅读全文
摘要:
public function index() { $ad = new Destoon_ad(); $data=[ 'url'=>'www.baidu.com', 'pid'=>'6666' ]; $where = ['aid'=>1]; $ad->save($data,$where); dump( 阅读全文
摘要:
添加操作 public function index() { //1.实列化模型,创建模型对象 $ad = new Destoon_ad(); //2.创建数据,采用对象方式 $ad->pid = '666'; $ad->url = 'www.666.com'; //3.执行添加操作 $result 阅读全文
摘要:
在模块下创建modle文件夹 <?phpnamespace app\index\model;use think\Model; class Destoon_ad extends Model{ //创建模型成功;} 实例化,查询模型 public function index() { $ad = new 阅读全文
摘要:
新增方法 $affected = Db::table('destoon_ad') ->insert([ 'pid'=>'2018', 'url'=>'www.baidu.com' ]); return $affected ? '成功添加'.$affected.'条数据' : '添加失败'; 批量新增 阅读全文
摘要:
dump( Db::table('destoon_ad') ->where('aid',1) ->find() ); dump( Db::table('destoon_ad') ->field(['title','image_url']) ->where([ 'aid'=>['>',1], 'pid 阅读全文