[英]create json array with php
您应该使用键/索引
foreach ($q->result() as $key=>$row){
$djson[ ( $key + 1 ) ] = array(
'id' => $row->id_custome,
'name' => $row->nama_custome
);
}
return $djson;
注意: $key + 1
因为你想从1
开始json。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.