门面模式加载数据库,按需加载,易于扩展。
静态调用Db类
use startmvc\core\Db;// 引入Db 类
$result = DB::table('article')->get();
dump($result);
表Table/From
table()和from()方法通用
### 用法1: 字符串参数
DB::table('table');
# 输出: "SELECT * FROM table"
DB::table('table1, table2');
# 输出: "SELECT * FROM table1, table2"
DB::table('table1 AS t1, table2 AS t2');
# 输出: "SELECT * FROM table1 AS t1, table2 AS t2"
### 用法2: 数组参数
DB::table(['table1', 'table2']);
# 输出: "SELECT * FROM table1, table2"
DB::table(['table1 AS t1', 'table2 AS t2']);
# 输出: "SELECT * FROM table1 AS t1, table2 AS t2"
以上的table可以用from代替