我有这个数组,
$sql = "SELECT s.sitter_id,s.sitter_id,s.name as sitter_name,s.mobile_no FROM `maggie_trusted_circle` t INNER JOIN maggie_sitters s ON t.sitter_id = s.sitter_id Where t.mom_id =". $params['mom_id'];
$trusted_circle = $this->db->executeQuery($sql);
我正在使用它通过
访问更多数据for($i=0; $i<sizeof($trusted_circle); $i++)
{
$mutual_friend = $trusted_circle[$i]['sitter_id'];
$mutual_friend_name = $trusted_circle[$i]['sitter_name'];
$sql = "SELECT s.sitter_id,s.name as sitter_name,s.mobile_no FROM `maggie_trusted_circle` t INNER JOIN maggie_sitters s ON t.sitter_id = s.sitter_id Where t.mom_id =". $mutual_friend;
$extended_trusted_circle[$i] = $this->db->executeQuery($sql);
$extended_trusted_circle[$i]['mutual_friend_id']= $mutual_friend;
$extended_trusted_circle[$i]['mutual_friend_name']= $mutual_friend_name;
}
并对响应进行编码
return json_encode(array('flag'=>1, 'message'=>'Success' ,'extended_trusted_circle'=>$extended_trusted_circle);
一切正常,除了索引号也打印在JSON响应
中这可能是什么原因?我通常认为索引号码不会打印,我错过了什么?
答案 0 :(得分:1)
你看到那些0-s的原因是:
transform : perspective(500px)rotateX(0.001deg);
返回如下数组:
$extended_trusted_circle[$i] = $this->db->executeQuery($sql);
0是行号,但它总是只返回1行
答案 1 :(得分:0)
尝试死亡();在json_encode之后