![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
tp5
有衡
这个作者很懒,什么都没留下…
展开
-
topthink/think-orm 操作数据库自增或者自减
$num = 1//自增$result = Db::name('user')->where('name',$name)->inc('num',$num)->update()//自减$result = Db::name('user')->where('name',$name)->dec('num',$num)->update()原创 2022-01-03 14:34:05 · 619 阅读 · 0 评论 -
tp5.1中使用join left时的左表的关联对象不唯一
在tp5.1使用join left时的左表的关联对象不唯一时就回出现1:n的情况,这样join left的后的结果,记录数量会多于右表的数量解决办法:这种情况需要保证左表符合条件的记录是空或者是唯一的,可以通过group来实现!$result = Db::table('user') ->alias('t1') ->join('log t2','t1.user_id=t2.uid','left') ->group('uid') //->order('uid desc')原创 2021-03-19 16:09:42 · 1251 阅读 · 0 评论 -
tp5.1 报错Fatal error: require(): Failed opening required
Warning: require(D:\Virtualmachine\TP5\V-admin/thinkphp/base.php): failed to open stream: No such file or directory in D:\Virtualmachine\TP5\V-admin\think on line 16Fatal error: require(): Failed opening required 'D:\Virtualmachine\TP5\V-admin/thinkphp/原创 2020-12-29 15:08:23 · 8376 阅读 · 1 评论 -
阿里云IP归属地接口
用tp5写的接口我用的是这个:https://market.aliyun.com/products/57002002/cmapi00035184.html?spm=5176.10695662.1996646101.searchclickresult.549c173dYGx2YO#sku=yuncode2918400001public function chat() { //t...原创 2020-03-18 16:37:58 · 186 阅读 · 0 评论 -
阿里云号码认证服务服务端PHP版
TP5.1写的api官方接入说明:https://github.com/aliyun/openapi-sdk-php/blob/master/README-zh-CN.md?spm=a2c4g.11186623.2.13.267a16e4QkHp9N&file=README-zh-CN.md客户端对接好之后,发送请求到服务端composer下载PHP版sdkcomposer req...原创 2020-03-18 15:53:10 · 1030 阅读 · 0 评论 -
tp5.1的路由
在tp5.1当中可以不用写路由,自动会有路由,直接根据模块控制器方法访问即可,默认都是get请求方式原创 2020-03-12 15:40:43 · 297 阅读 · 0 评论 -
tp5 Call to a member function toArray() on array 报错
tp5中遇到将database.php里面的'resultset_type' => 'array'// 数据集返回类型'resultset_type' => 'array',改成// 数据集返回类型'resultset_type' => 'collection',就可以了...原创 2020-03-03 17:20:40 · 1342 阅读 · 0 评论 -
tp5 Db类根据字段查询数据库
tp5 Db类根据字段查询数据库//查询goods表 从第一条开始查20条内容 查询goods表里的goods_id,goods_name,goods_price字段$goods = Db::name("goods")->limit(1,20)->field('goods_id,goods_name,goods_price')->select();...原创 2020-02-02 11:29:17 · 977 阅读 · 0 评论 -
tp5允许跨域请求
在tp5的入口文件里面加入以下内容即可header("Access-Control-Allow-Origin:*");header("Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE");header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-A...原创 2020-02-01 17:22:59 · 2794 阅读 · 0 评论