明霞山资源网 Design By www.htccd.com
json_encode 索引为数字,自动排序问题
使用son_encode 给前端返回数据,结果顺序不对,经debug调试,发现是json_encode 函数的问题;
{
"code": 0,
"msg": "请求成功!",
"data": {
"2018-10": {
"17": [
{
"id": 730,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "长春燃气",
"stock_code": "600333",
"in_timed_at": 1539756681,
"price": "6.4"
}
],
"18": [
{
"id": 735,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "天孚通信",
"stock_code": "300394",
"in_timed_at": 1539828137,
"price": "17.7"
}
],
"19": [
{
"id": 748,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "科大讯飞",
"stock_code": "002230",
"in_timed_at": 1539941525,
"price": "31.87"
}
],
"09": [
{
"id": 706,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "温州宏丰",
"stock_code": "300283",
"in_timed_at": 1539048922,
"price": "4.83"
}
]
},
"2018-09": {
"29": [
{
"id": 702,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "新美星",
"stock_code": "300509",
"in_timed_at": 1538212392,
"price": "13.36"
}
]
}
}
}
解决办法:在数字索引前加个空格。如“ 19” “ 18”完美解决问题。
解决方法:变成 " " + 数字即可,例如:" 18", " 19"
{
"code": 0,
"msg": "请求成功!",
"data": {
"2018-10": {
" 19": [
{
"id": 748,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "科大讯飞",
"stock_code": "002230",
"in_timed_at": 1539941525,
"price": "31.87"
}
],
" 18": [
{
"id": 735,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "天孚通信",
"stock_code": "300394",
"in_timed_at": 1539828137,
"price": "17.7"
}
],
" 17": [
{
"id": 730,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "长春燃气",
"stock_code": "600333",
"in_timed_at": 1539756681,
"price": "6.4"
}
],
" 09": [
{
"id": 706,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "温州宏丰",
"stock_code": "300283",
"in_timed_at": 1539048922,
"price": "4.83"
}
]
},
"2018-09": {
" 29": [
{
"id": 702,
"uid": "118209",
"is_read": false,
"biggest_high": 0,
"first_read_at": "",
"stock_name": "新美星",
"stock_code": "300509",
"in_timed_at": 1538212392,
"price": "13.36"
}
]
}
}
}
明霞山资源网 Design By www.htccd.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
明霞山资源网 Design By www.htccd.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。