<?php
namespace app\index\controller;
use tink\Db;
class Index
{
public function hello()
{
$where['dept_id'] = ['>',6];
$where['uid'] = ['>',10];
$r['data']=db('user')->where($where)->field('USER_NAME,dept_id')->page(input('page'),5)->select();
$r['total']=db('user')->count();
echo db('user')->getLastSql();
try {
db()->startTrans();
db()->execute("UPDATE `accounts` SET `balance` = balance - 100 WHERE `user_id` = 1");
db()->execute("UPDATE `accounts` SET `balance` = balance + 100 WHERE `user_id` = 2");
db()->commit();
} catch (\Exception $e) {
db()->rollback();
throw $e;
}
}
public function c(){
cache('aa', "adsd", 3600);
var_dump(cache('aa'));
cache('aa', NULL);
}
}
`