通过php对后台数据库作相关表查询后如何通过echo json_encode($数组);方法输出json格式的查询结果?
PHP数据库查询语句:$rs=mysql_query("selectplayerid,name,level,exp,gold,money,action,fightvalu...
PHP数据库查询语句:
$rs = mysql_query("select playerid, name, level, exp, gold, money, action, fightvalue, sppower from $table_query where name='yoyi'", $conn);
查询结果将会是唯一的一条匹配用户记录,而我希望通过echo的方法,按照json格式输出查询结果的记录键值对
{"playerid":"604563462527849255","name":"yoyi","level":"1","exp":"0","gold":"0","money":"3400","action":"19","fightvalue":"271","sppower":"0"} 展开
$rs = mysql_query("select playerid, name, level, exp, gold, money, action, fightvalue, sppower from $table_query where name='yoyi'", $conn);
查询结果将会是唯一的一条匹配用户记录,而我希望通过echo的方法,按照json格式输出查询结果的记录键值对
{"playerid":"604563462527849255","name":"yoyi","level":"1","exp":"0","gold":"0","money":"3400","action":"19","fightvalue":"271","sppower":"0"} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询