thinkphp5 select 与 column不同之处

记录一下他们两者的不同

写法不同

select查询表中所有符合的数据要写成 select();
column查询表中所有符合的数据要写成 column('');

如果互相间多了''或少了'',那么便会出问题。
我也不知道作者在处理这些数据时怎么想的,可能和我脑内存一样不足,导致的出现这种写法差异。

查询后的数组下标不同

我们将查询到的直接用json输出

select查询后的是

[{"id":1,"img_id":65,"key_word":"6","type":1,"delete_time":null,"banner_id":1,"update_time":null},{"id":2,"img_id":2,"key_word":"25","type":1,"delete_time":null,"banner_id":1,"update_time":null},{"id":3,"img_id":3,"key_word":"11","type":1,"delete_time":null,"banner_id":1,"update_time":null},{"id":5,"img_id":1,"key_word":"10","type":1,"delete_time":null,"banner_id":1,"update_time":null}]

column查询到的是

{"1":{"id":1,"img_id":65,"key_word":"6","type":1,"delete_time":null,"banner_id":1,"update_time":null},"2":{"id":2,"img_id":2,"key_word":"25","type":1,"delete_time":null,"banner_id":1,"update_time":null},"3":{"id":3,"img_id":3,"key_word":"11","type":1,"delete_time":null,"banner_id":1,"update_time":null},"5":{"id":5,"img_id":1,"key_word":"10","type":1,"delete_time":null,"banner_id":1,"update_time":null}}

评论

大侠名号:   验证暗号: 点击我更换图片

修远兮

在这里记录每一点自己需要的知识

添加创始人微信,一起交流心得

推荐文章RECOMMEND