数据库配置-全局设置
application\database.php
数据库配置-局部设置
application\index\database.php
原生查询
增,删,改,查
execute, query
~~~
insert into user ('name','age') values('jim',18);
delete from user where name='jim';
update user set age=20 where name='jim';
select name,age from user where age=18;
~~~
~~~
use think\Db;
...
$sqlStr = "insert into user ('name','age') values('jim',18)";
$result = Db::execute($sqlstr);
dump($result);
$sqlStr= "show tables from user";
$result = Db::query($sqlstr);
dump($result);
$sqlStr = "truncate table user";
$result = Db::execute($sqlstr);
dump($result);
~~~