Db::table( ‘数据表名’ ) -> where( 查询条件 ) -> column( ‘字段列表’, ‘数组键名’ ) ;

Db::table('User')->where(['status'=>['>',0]])->column('id,name,tel','tel');
返回结果
[
	'15698963256'=>[
		'id'=>1,
		'name'=>'小明',
		'tel'=>'15698963256'
	]
]

TP5数据操作指定查询字段为结果集key
参考:https://www.kancloud.cn/ldkt/tp5_db/229042

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-02-22
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2021-07-18
相关资源
相似解决方案