我将PHP数组转换为JSON成功但是我的目标没有完全填充。
我的出局是:
{"id":"145","logid":"","name":"asasa"}{"id":"144","logid":"","name":"qwsqwswq"}{"id":"145","logid":"","name":"asasa"}{"id":"144","logid":"","name":"qwsqwswq"}
我的要求:
[{"id":"145","logid":"","name":"asasa"}{"id":"144","logid":"","name":"qwsqwswq"}{"id":"145","logid":"","name":"asasa"}{"id":"144","logid":"","name":"qwsqwswq"}]
这是我的代码: -
if ($AdminRecord) {
foreach($AdminRecord->result() as $results)
{
echo json_encode($results);
}
}
答案 0 :(得分:4)
您正在输出每一行,而不是尝试:
=