<?php
namespace Home\Controller;
use Think\Controller;
class MainController extends Controller{
    public function test(){
        //造模型对象
        //$n = D("nation");
        //var_dump($n);
        
        //查询所有数据
        //$arr = $n->select();
        
        //查一条数据
        //$arr = $n->find();
        
        //查总条数
        //$arr = $n->count();
        
        //查最大值
        //$arr = $n->max();
        
        //查最小值
        //$arr = $n->main();
        
        //查平均值
        //$arr = $n->avg();
        
        //连贯操作
        //加条件
        //$arr = $n
        //->where()
        //->select();
        
        //切换数据表
        //$arr = $n
        //->table()
        //->select();
        
        //操作某几列
        //$arr = $n
        //->field(/*指定列*/)
        //->select();
        
        //排序
        //$arr = $n
        //->order()
        //->select();
        
        //Limit分页
        //$arr = $n
        //->limit(2,2)
        //->select();
        
        //page分页
        //$arr = $n
        //->page(1,2)
        //->select();
        
        //分组
        //$arr = $n
        //->table()
        //->field()
        //->group()
        //->select();
        
        //连接查询
        //$arr = $n
        //->field(/*指定列*/)
        //->join()
        //->select();
        
        //去重查询
        //$arr = $n
        //->field(/*指定列*/)
        //->distinct(true)
        //->select();
        
        //var_dump($arr);
    }
}

 

posted on 2017-11-02 10:32  唯懿  阅读(192)  评论(0编辑  收藏  举报