Thinkphp5中使用mysql的concat函数
2022-07-28 14:14:58
184
{{single.collect_count}}

需要注意你的TP版本 如果是5.0.18+ 需要使用新的写法
这里我用的5.0.21版 也用它作为演示:

concat()在原有字符的基础上追加新字符db('a')->where('id', 1)->update(['name' => Db::raw('concat(name,"在原来的字符上追加新的字符")')])

例:

字段name原值为 “112233”,在执行此sql后变成 “112233在原来的字符上追加新的字符”

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}