摘要:        
方法 public function index() { $ad = Destoon_ad::get(2); return $ad->totime; } 模型下创建读取器 protected function getTotimeAttr($totime){ return date('Y-m-d',$    阅读全文
posted @ 2018-04-15 20:56
我是谁,我在做什么
阅读(152)
评论(0)
推荐(0)
        
            
        
        
摘要:        
delete()方法 $result = Destoon_ad::get(['aid'=>['=',17]]); dump($result->delete()); destroy()方法 public function index() { $where = function($query){ $qu    阅读全文
posted @ 2018-04-15 20:34
我是谁,我在做什么
阅读(113)
评论(0)
推荐(0)
        
            
        
        
摘要:        
public function index() { //模型实列化调用get()和find()方法 $ad = new Destoon_ad; $where = function($query){ $query->field(['pid','url'])->where('aid',1); }; $r    阅读全文
posted @ 2018-04-15 20:06
我是谁,我在做什么
阅读(282)
评论(0)
推荐(0)
        
            
        
        
摘要:        
public function index() { $ad = new Destoon_ad(); $data=[ 'url'=>'www.baidu.com', 'pid'=>'6666' ]; $where = ['aid'=>1]; $ad->save($data,$where); dump(    阅读全文
posted @ 2018-04-15 19:26
我是谁,我在做什么
阅读(227)
评论(0)
推荐(0)
        
            
        
        
摘要:        
添加操作 public function index() { //1.实列化模型,创建模型对象 $ad = new Destoon_ad(); //2.创建数据,采用对象方式 $ad->pid = '666'; $ad->url = 'www.666.com'; //3.执行添加操作 $result    阅读全文
posted @ 2018-04-15 18:39
我是谁,我在做什么
阅读(163)
评论(0)
推荐(0)
        
            
        
        
摘要:        
在模块下创建modle文件夹 <?phpnamespace app\index\model;use think\Model; class Destoon_ad extends Model{	//创建模型成功;} 实例化,查询模型 public function index() { $ad = new    阅读全文
posted @ 2018-04-15 18:11
我是谁,我在做什么
阅读(144)
评论(0)
推荐(0)
        
            
        
        
摘要:        
新增方法 $affected = Db::table('destoon_ad') ->insert([ 'pid'=>'2018', 'url'=>'www.baidu.com' ]); return $affected ? '成功添加'.$affected.'条数据' : '添加失败'; 批量新增    阅读全文
posted @ 2018-04-15 17:39
我是谁,我在做什么
阅读(185)
评论(0)
推荐(0)
        
            
        
        
摘要:        
dump( Db::table('destoon_ad') ->where('aid',1) ->find() ); dump( Db::table('destoon_ad') ->field(['title','image_url']) ->where([ 'aid'=>['>',1], 'pid    阅读全文
posted @ 2018-04-15 11:43
我是谁,我在做什么
阅读(152)
评论(0)
推荐(0)
        
 
                    
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号