知道如何通过查询解决这个问题吗?
$obj = array(
"attr" => array(
"id" => 1,
"rel" => "drive"
),
"data" => "My Documents",
"children" => array(
array(
"attr" => array(
"id" => 2,
"rel" => "file"
),
"data" => "file1.doc",
"state" => ""
)
)
);
echo json_encode($obj);
我只需要在上面代码的一部分下面循环。
array(
"attr" => array(
"id" => 2,
"rel" => "file"
),
"data" => "file1.doc",
"state" => ""
)
任何帮助都会很棒。
由于
答案 0 :(得分:0)
您可以尝试编译和安装第三方JSON UDF:
答案 1 :(得分:0)
$x = 0;
while($row = mssql_fetch_object($query) )
{
$json[$x] = array (
'lastname' => $row->firstname,
'firstname' => $row->lastname
);
$x++;
}
echo json_encode($json);