5 篇
建站知识总结与分享
搜索“insertAll”
thinkphp5 saveAll insertAll getLastInsID
taotaoit 0 0
74 0 2024-04-11 ThinkPHP5.1
thinkphp5 saveAll insertAll getLastInsID 批量新增数据,能不能获得最后增加数据的id? 1,模型方法: $datas = []; $datas[] = ['articleTitle'=>'标题1']; $datas[] = ['articleTitle'=&...
tp5,批量添加insertAll,分批插入Db::name('user')->data($data)->limit(100)->insertAll();
taotaoit 0 0
854 0 2023-09-22 ThinkPHP5.1
用tp5做excel批量导入的时候,由于数据量很大(6万条),导致提示如下错误: The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the ...
TP5.1 insert添加数据时自动时间戳create_time无效
web 0 1
2361 0 2021-03-25 ThinkPHP5.1
平常添加数据一般都用allowField(true)->save(),自动添加时间戳。 但是用insert和insertAll新增数据,create_time和update_time不会自动生成时间戳。 save 是模型方法 会自动写入时间戳 insert 是Db方法 不会自动写入时间戳的
thinkphp5.1添加数据
web 0 0
2278 0 2019-01-07 ThinkPHP5.1
<?php namespace app\index\model; use think\Db; class Articles { /** * 添加一条数据 * insert 方法添加数据成功返回添加成功的条数,通常情况返回 1 */ public function insert(){ $data = ['arti...
insertAll_批量添加
web 0 0
2048 0 2018-10-08 ThinkPHP
这里只是拷贝一下手册代码,详情请查看手册 <?php namespace app\index\controller; use think\Db; class Index { public function index(){ // 1.创建员工信息数组 $data = []; ...
关于本站

“最难不过坚持”

本人承接扒站仿站,php网站维护,病毒查杀,网站编辑,网站改版,html制作

有需要网站维护,改版,病毒查杀,网站编辑,网站备案,html制作等相关的工作可以联系我。
本人有多年相关工作经验,也可提供免费咨询,交个朋友。
有需要探讨问题的朋友,也可以加我微信,共同探讨!
微信:15011482830 QQ:408917339

6399573 2609 39
最新评论
https://jueru.net/
评 留言
:weixiao:
评 留言
:shuijiao: :weiqu: :zhenbang: :leng:
评 留言
:yiwen: :yiwen: :yiwen: :yiwen:
评 EasySass: could not generate CSS file. See Output panel for details.
这个业务逻辑多少都有点奇怪了,阅读浏览次数增值在新闻详情页的控制器方法里setInc,这怎么还写进模型事件里了。如果非要用onAfterRead也可以,把新闻文章的内容单独分出来一个news_content表,然后把它和news做关联,然后给news_content表的onAfterRead事件做增值处理,这样点进新闻页内查询到文章内容时才会触发它。
评 TP6模型事件-查询后onAfterRead不好用
文章标签更多
ThinkPHP (254)
Mysql (58)
DedeCms (33)
jQuery (67)
证件照 (1)
setInc (4)
setDec (4)
onclick (5)