/*
* 使用数据库
* 第一步:连接数入库
* 1、全局配置 \config\database.php 文件
* 2、动态配置(只适用一次使用) 方法在think\db\Query.php中有一个方法:connect()
* public function conn2()
* {
* return Db::connect([
* 'type'=>'mysql',
* 'hostname'=>'localhost',
* 'database'=>'demo',
* 'username'=>'root',
* 'password'=>'root',
* ])
* -> table('student') -> where('id',2) -> value('name');
* }
*
*
* 3、DSN连接字符串
* 数据库类型://用户名:密码@数据库地址:端口号/数据库的名称#字符集
* public function conn3($dsn)
* {
* $dsn = 'mysql://root:root@localhost:3306/demo#utf8';
* return Db::table('student') -> where('id',5) -> value('name');
* }
*
*
* */