代码拉取完成,页面将自动刷新
use taskphp\Utils;
/**
* 数据库配置
* */
'db'=>[
'type' => 'mysql',
'username' => 'root',
'password' => 'root',
'host' => '127.0.0.1',
'port' => '3306',
'name' => 'test',
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'test_',
// 开启断线重连
'break_reconnect'=>true,
],
2.数据库操作
//数据库操作 获取一条数据
/* $res=Utils::db('table1')->find();
Utils::log($res);*/
//方法二
$res=Utils::db()->table("table1")->where("id=1")->limit(2)->order("id DESC")->select();
Utils::log($res);
/* //方法三
$res=Utils::db()->table("user")->alias("a")->join("user_third AS b ON a.uid=b.uid","LEFT")->where("a.status=1")->limit(2)->order("a.uid DESC")->select();
Utils::log($res); */
//Utils::db()->table("user")->getSql() 打印sql语句
/* //方法四
$res=Utils::db()->table("user_phone_log")->where(array("phone_log_id"=>2))->update(array("uid"=>3));
Utils::log($res); */
//方法五
/*
$res=Utils::db()->table("user_phone_log")->add(array(
"uid" =>22,
"status" =>1,
"create_date" =>time(),
"phone" =>13111111
));
Utils::log($res); */
/* //方法六
$res=Utils::db()->table("user_phone_log")->where(array("uid"=>22))->delete();
Utils::log($res); */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。