Heim >Backend-Entwicklung >PHP-Tutorial >菜鸟,json输出
foreach ($query->result_array() as $row) { $data = array( 'id' => $row['id'], 'title' =>$row['title'] ); }echo json_encode($data);
foreach ($query->result_array() as $row)
{
$data[] = array(
'id' => $row['id'],
'title' =>$row['title']
);
}
foreach ($query->result_array() as $row)
{
$data[] = array(
'id' => $row['id'],
'title' =>$row['title']
);
}