这是我的JSON数据
driver.execute_script("window.open('http://facebook.com/');");
这是我的PHP代码
{
"gstin":"29AAHCS4690J1ZQ",
"fp":"072017",
"b2b":[
{
"ctin":"01AAACJ4126D1ZE",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1,
"itc":{
"tx_cs":0,
"elg":"ip",
"tx_i":112.5
},
"itm_det":{
"csamt":0,
"rt":18,
"txval":625,
"iamt":112.5
}
}
],
"val":738,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"31-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"FL-17000069",
"chksum":"4d3e41facf5002f418e1ac605d9888d74ee21652e19de6db624fc7106e3c5866"
}
]
},
{
"ctin":"29AACFI3027K1ZC",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1800,
"itc":{
"elg":"ip",
"tx_c":171.59,
"tx_s":171.59
},
"itm_det":{
"samt":171.59,
"rt":18,
"txval":1906.5,
"camt":171.59
}
}
],
"val":2250,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"06-07-2017",
"rchrg":"Y",
"cflag":"U",
"inum":"0042",
"chksum":"aa1187a2bb7d6098c39c4c992bd391ab7fd59e7eeefcea5b91fc9881ba4423d8"
}
]
},
{
"ctin":"29AAACT7966R2Z6",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":20,
"tx_s":20
},
"itm_det":{
"samt":20,
"rt":5,
"txval":800,
"camt":20
}
}
],
"val":800,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"06-07-2017",
"rchrg":"Y",
"cflag":"U",
"inum":"507002834",
"chksum":"64b19ecd192545bcfeac89f9ef7e30965122d5159be6a66d4c7888a8b6e1b6ae"
},
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":20.38,
"tx_s":20.38
},
"itm_det":{
"samt":20.38,
"rt":5,
"txval":815,
"camt":20.38
}
}
],
"val":815,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"26-07-2017",
"rchrg":"Y",
"cflag":"U",
"inum":"507015095",
"chksum":"c76544937d5f7b8513bb64d45ba5708ff4f67197652b6ba06a605931b7ce58b6"
}
]
},
{
"ctin":"29AACCM4309H1ZI",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1,
"itc":{
"tx_cs":0,
"elg":"ip",
"tx_c":329,
"tx_s":329
},
"itm_det":{
"samt":329,
"csamt":0,
"rt":28,
"txval":2350,
"camt":329
}
}
],
"val":3008,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"11-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"021/RS/17000016",
"chksum":"096e525d241d942cdf7695976d1dfc0ada181ab01d85dc6d6506d4865983a491"
},
{
"itms":[
{
"num":1,
"itc":{
"tx_cs":0,
"elg":"ip",
"tx_c":452.38,
"tx_s":452.38
},
"itm_det":{
"samt":452.38,
"csamt":0,
"rt":28,
"txval":3231.25,
"camt":452.38
}
}
],
"val":4136.01,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"21-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"021/RS/17000026",
"chksum":"196ff72d3507ea9fe69448cce2df27f9f3bf6ef05c2b691e47f245cb10f53747"
}
]
},
{
"ctin":"29ABRPH6549P1ZK",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1800,
"itc":{
"elg":"ip",
"tx_c":114.39,
"tx_s":114.39
},
"itm_det":{
"samt":114.39,
"rt":18,
"txval":1271,
"camt":114.39
}
}
],
"val":1500,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"31-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"10",
"chksum":"5e2c5b651c027f5707fddd422de3301e71d3a713169c9de00da7de688742b030"
},
{
"itms":[
{
"num":500,
"itc":{
"elg":"ip",
"tx_c":132.5,
"tx_s":132.5
},
"itm_det":{
"samt":132.5,
"rt":5,
"txval":5300,
"camt":132.5
}
},
{
"num":1200,
"itc":{
"elg":"ip",
"tx_c":24,
"tx_s":24
},
"itm_det":{
"samt":24,
"rt":12,
"txval":400,
"camt":24
}
}
],
"val":6013,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"24-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"9",
"chksum":"8aa3acd295c97aad72b174bfd98a521914e5c869608cafbc1f07ed1472f269ca"
}
]
},
{
"ctin":"29AAXFM9455A1ZO",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":385.56,
"tx_s":385.56
},
"itm_det":{
"samt":385.56,
"rt":28,
"txval":2754,
"camt":385.56
}
}
],
"val":3526,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"28-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"1718/508",
"chksum":"03bbeb45778a4ea3019d7c7a2a71d2d3e48ed2433fe4e027606fb2dba59d4a64"
}
]
},
{
"ctin":"29AAACE3688F1ZG",
"cfs":"Y",
"inv":[
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":882.42,
"tx_s":882.42
},
"itm_det":{
"samt":882.42,
"rt":28,
"txval":6303,
"camt":882.42
}
}
],
"val":8068,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"19-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"EEPLB1718/1208",
"chksum":"7afd73b6b9aeada9113b54ec7151ba08fb2ca0a8e23fc89ac3126d8c9722ff66"
},
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":1137.08,
"tx_s":1137.08
},
"itm_det":{
"samt":1137.08,
"rt":28,
"txval":8122,
"camt":1137.08
}
}
],
"val":10396,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"24-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"EEPLB1718/1267",
"chksum":"5079a0d6c289ee0077fb2fd167fd88691f2a1557cff0d2789912bc9460d35f98"
},
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":549.36,
"tx_s":549.36
},
"itm_det":{
"samt":549.36,
"rt":28,
"txval":3924,
"camt":549.36
}
}
],
"val":5023,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"26-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"EEPLB1718/1289",
"chksum":"6480112156a400f0ca2380c577c7a59c7a4321da5e845f577be992b6324219ee"
},
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":888.16,
"tx_s":888.16
},
"itm_det":{
"samt":888.16,
"rt":28,
"txval":6344,
"camt":888.16
}
}
],
"val":8120,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"28-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"EEPLB1718/1322",
"chksum":"4d0f2654fd0c1c1bf0c1a2fceb18adeb74123ec62d2556f569f22372f9ece4e1"
},
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":602.98,
"tx_s":602.98
},
"itm_det":{
"samt":602.98,
"rt":28,
"txval":4307,
"camt":602.98
}
}
],
"val":5513,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"29-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"EEPLB1718/1323",
"chksum":"a3f0dba67b1352affd1877d45a9eabfe99a60f67cda693881c24ab1f2c967a6d"
},
{
"itms":[
{
"num":1,
"itc":{
"elg":"ip",
"tx_c":939.68,
"tx_s":939.68
},
"itm_det":{
"samt":939.68,
"rt":28,
"txval":6712,
"camt":939.68
}
}
],
"val":8591,
"inv_typ":"R",
"flag":"N",
"updby":"S",
"pos":"29",
"idt":"29-07-2017",
"rchrg":"N",
"cflag":"U",
"inum":"EEPLB1718/1324",
"chksum":"77f0c25a4b574129b882395d5a79955cfe23c80cd7edf9accef0afd798696478"
}
]
}
]
在这个JSON数据中,我在数组[b2b]和[inv]中得到正确的值,但是我没有正确地获取[itms]值意味着如果我迭代itms数组那个时候如果ctin包含10个itms那么foreach循环因为重复的值插入到数据库中,因此首先迭代itach循环而不是深度循环。提前谢谢