摘要: 【模型时间戳】 应用配置文件【不过一般不这样用】 // 自动写入时间戳字段 'auto_timestamp' => true, 【控制器块】namespace app\index\controller; use think\Controller;use app\index\model\App; cl 阅读全文
posted @ 2017-07-11 18:39 高锴 阅读(2025) 评论(0) 推荐(0) 编辑
摘要: namespace app\index\model; use think\Model; class App extends Model{ //自动完成[新增和修改时都会执行] protected $auto =[ 'time' //要验证的字段 ]; //新增时自动验证 protected $ins 阅读全文
posted @ 2017-07-11 16:47 高锴 阅读(2934) 评论(1) 推荐(0) 编辑
摘要: 【模型获取器】 【控制器块】namespace app\index\controller; use think\Controller;use app\index\model\App; class Index extends Controller{ public function index() { 阅读全文
posted @ 2017-07-11 16:15 高锴 阅读(1358) 评论(0) 推荐(1) 编辑
摘要: 几种调用模型的方法: use think\Controller; //use app\index\model\App; use think\Loader; class Index extends Controller{ public function index() { //$res = App:: 阅读全文
posted @ 2017-07-11 15:10 高锴 阅读(5695) 评论(0) 推荐(0) 编辑
摘要: Db::query();Db::execute(); Db::table()->select(); 所有数据,二维数组,结果不存在时返回空数组Db::table->find(); 一条数据,一维数组,结果不存在时返回NULL Db::table->value(); 一条数据, 结果不存在时返回空Db 阅读全文
posted @ 2017-07-11 11:58 高锴 阅读(1112) 评论(0) 推荐(0) 编辑