【发布时间】:2021-03-06 01:14:37
【问题描述】:
我有这个代码
**$datas=DB::table('uni_staff')
->join('department','uni_staff.department_id','department.id')
->join('uni_staff_type','uni_staff.type_id','uni_staff_type.id')
->select('uni_staff.*','department.dep_name as departmentName' , 'uni_staff_type.user_type as
typeName')
->where('uni_staff.id',$id)
->select('uni_staff.*')
->get();**
我想将一行的每一列值放到一个索引数组中,或者通过列索引或其他“$datas[0]”而不是“$datas->id”等列名来打印结果
【问题讨论】:
-
您能否详细说明预期的结果和用途是什么?
-
@MhluziBhaka 这是我的查询结果:{"id":3,"first_name":"pepe","middle_name":"ahmad","last_name":"ali","full_name ":"pep shan kj","pho_number":"ml;k","user_code":"ljl;j","type_id":1,"department_id":2,"internet1":"5654","internet2 ":"545","printer_code":546,"status":"544","date":"2020-11-18","note":"dsds","add_by":"dsd","departmentName ":"Design","typeName":"Employee"} 我想把所有的列值放到一个数组中然后使用循环打印数组
标签: php arrays database laravel