zoukankan      html  css  js  c++  java
  • 模型的CURD操作

    class Index
    {
        public function index()
        {
            return '<h3>欢迎来到PHP中文网</h3>';
        }
    
        public function demo()
        {
    //      $res = Staff::get(1);
    
    
    //        $where = function ($query) {
    //            $query->field(['name','salary','age'])
    //                ->where('id','=',1);
    //        };
    //        $res = Staff::get($where);
    
    
    
    //        $where = function ($query) {
    //            $query->field(['name','salary','age'])
    //                ->where('salary','>',8000);
    //        };
    //        $result = Staff::all($where);
    //        foreach ($result as $value){
    //            dump($value);
    //            dump(gettype($value));
    //        }
    
    
    
    
    
    
    //      $res = Staff::create([
    //            'name'=>'林平之','age'=>28,'salary'=>300
    //      ]);
    
    
            //save      返回boole
            //delete    返回boole
            //destroy   返回boole
    
    
    
    //        $data = [
    //            'name'=>'韦一笑','age'=>59,'salary'=>5600
    //        ];
    //        $where = ['id'=>6];
    //        $field = ['name','age','salary'];
    //        $res = Staff::update($data,$where,$field);
    
    
    
    //            $res = Staff::get(17);
    //            $affected = $res->delete();
    //            dump($affected);
    
    
    //            $where = function ($query){
    //              $query->where('id','=',10);
    //            };
    //            $value = Staff::destroy($where);
    //            dump($value);
    //            dump(gettype($value));
    
    
    
    
    
    
    
    //      dump($res);
    
    //      dump(gettype($res));
    
    
    
        }
    }
    

      

  • 相关阅读:
    Asp.net的安全问题
    周末了
    GDI+ 取得文本的宽度和高度
    Family的解释
    日语:名词并列
    第一次来入住园里
    All About Floats
    smarty的基本配置
    apache:一个ip绑定多个域名的问题
    CSS Overflow属性详解
  • 原文地址:https://www.cnblogs.com/qq254980080/p/9430597.html
Copyright © 2011-2022 走看看