<?php
$sql="select * from tb1";
require(*conn.php*);
if($result)
{
$users; $i=0;
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
$users[$i]=$row;
$i++;
}
echo json_encode(array($users));
}
mysql_free_result($result);
//释放结果
mysql_close();
//关闭连接
?>
结果 [[{"name":"1","code":"??","price":"3"},{"name":"4","code":"5","price":"6"}]]
感觉多了俩个方括号 怎么改啊
$sql="select * from tb1";
require(*conn.php*);
if($result)
{
$users; $i=0;
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
$users[$i]=$row;
$i++;
}
echo json_encode(array($users));
}
mysql_free_result($result);
//释放结果
mysql_close();
//关闭连接
?>
结果 [[{"name":"1","code":"??","price":"3"},{"name":"4","code":"5","price":"6"}]]
感觉多了俩个方括号 怎么改啊