thinkphp5 查询json字段

凯约

关注

阅读 84

2022-08-18


tp5.1已经支持json字段查询了

tp5.0还不支持,只能使用原生查询了

搞个例子


$momo = Db::query("select switchs->'$[*]' from timer where JSON_CONTAINS(switchs->'$[*].id', '\"$id\"', '$') and
JSON_CONTAINS(switchs->'$[*].fid', '\"$fid\"', '$') and
JSON_CONTAINS(switchs->'$[*].pid', '\"$pid\"', '$')"
);

 

精彩评论(0)

0 0 举报