当前位置:网站首页>Two dimensional format array format index subscript continuity problem leads to return JSON format problem
Two dimensional format array format index subscript continuity problem leads to return JSON format problem
2022-07-03 02:34:00 【qq_ twenty-seven million eight hundred and seventy-eight thousa】
1. Array subscripts are continuous return json Format without index
[
0=>[
'id'=>1,
'title'=>' Test one ',
],
1=>[
'id'=>1,
'title'=>' Test one ',
],
2=>[
'id'=>1,
'title'=>' Test one ',
],
]
{
"msg": "ok",
"data": [
{
"id": 1,
"title": " Test one "
},
{
"id": 1,
"title": " Test one "
},
{
"id": 1,
"title": " Test one "
}
]
}
2. Array subscripts are discontinuous , return json Format with index
[
0=>[
'id'=>1,
'title'=>' Test one ',
],
2=>[
'id'=>1,
'title'=>' Test one ',
],
5=>[
'id'=>1,
'title'=>' Test one ',
],
];
{
"msg": "ok",
"data": {
"0": {
"id": 1,
"title": " Test one "
},
"2": {
"id": 1,
"title": " Test one "
},
"5": {
"id": 1,
"title": " Test one "
}
}
}
3. terms of settlement Reset index continuation
// Reset continuous index
$lst = array_slice($lst, 0, count($lst), false);
return $lst;
边栏推荐
- Create + register sub apps_ Define routes, global routes and sub routes
- [Hcia]No.15 Vlan间通信
- Why choose a frame? What frame to choose
- Restcloud ETL cross database data aggregation operation
- Hcip137-147 title + analysis
- 【ROS进阶篇】第六讲 ROS中的录制与回放(rosbag)
- MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
- Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
- [translation] flux is safe. Gain more confidence through fuzzy processing
- GBase 8c系统表-pg_conversion
猜你喜欢
Basic operation of binary tree (C language version)
4. 类和对象
easyExcel
Return a tree structure data
搭建私有云盘 cloudreve
Tongda OA V12 process center
[translation] the background project has joined the CNCF incubator
通达OA 首页门户工作台
Classes and objects - initialization and cleanup of objects - constructor call rules
Choose it when you decide
随机推荐
怎么将yolov5中的PANet层改为BiFPN
Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid
awk从入门到入土(0)awk概述
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
[hcia]no.15 communication between VLANs
面试八股文整理版
簡單理解svg
Kotlin middle process understanding and Practice (II)
8 free, HD, copyright free video material download websites are recommended
Gbase 8C system table PG_ database
Detailed introduction to the deployment and usage of the Nacos registry
Kotlin middle process understanding and Practice (I)
Gbase 8C system table PG_ am
Current situation and future of Web3 in various countries
Principle and application of database
Gbase 8C system table PG_ authid
SPI机制
GBase 8c系统表-pg_collation
GBase 8c系统表-pg_conversion
Detailed analysis of micro service component sentinel (hystrix)