亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

URL_JSON番外篇

原創(chuàng) 2019-03-22 13:13:13 196
摘要:<?phpnamespace app\index\controller;use think\Collection;use think\Db;use think\db\Query;class Test1 extends Collection{    //數(shù)據(jù)庫(kù)連接測(cè)試 靜態(tài)連接,動(dòng)態(tài)連接,環(huán)境變量連接,模型連接    public function de

<?php


namespace app\index\controller;
use think\Collection;
use think\Db;
use think\db\Query;

class Test1 extends Collection
{
   //數(shù)據(jù)庫(kù)連接測(cè)試 靜態(tài)連接,動(dòng)態(tài)連接,環(huán)境變量連接,模型連接
   public function demo1(){
       //靜態(tài)連接 database.php
       $res=Db::table('staff')->limit(1)->select();

       //動(dòng)態(tài)連接 database.php 'my_db'
       $res=Db::connect('my_db')
           ->table('staff')
           ->limit(2)
           ->select();
       //環(huán)境變量 類似用戶自定義的全局變量,一次定義,都能用,定義.env文件
       $res=Db::table('staff')->limit(3)->select();
       //模型連接
       $res=\app\index\model\Staff::limit(4)->select();


       dump($res);
   }

批改老師:天蓬老師批改時(shí)間:2019-03-22 13:40:34
老師總結(jié):解答正確 , 如果是自己全程自己想著寫的, 就非常厲害了

發(fā)布手記

熱門詞條