前言[随时更新]
MySQL快速复习
MySQL原生查询
选择数据表
删除数据
聚合查询
时间查询
视图查询
子查询
总结/参考
/**
* 指定默认的数据表名(不含前缀)
* @access public
* @param string $name
* @return $this
*/
public function name($name)
{
$this->name = $name;
return $this;
}
<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
class Index extends Controller {
public function index(){
dump(Db::name('staff')->find('1003'));
}
}
array(7) {
["id"] => int(1003)
["name"] => string(6) "杨过"
["sex"] => int(0)
["age"] => int(35)
["salary"] => float(5303)
["dept"] => string(9) "市场部"
["hiredate"] => string(10) "2014-09-22"
}