Answer the question
In order to leave comments, you need to log in
How to loop through arrays using foreach?
Hello, there is an array $item, when you print the array, there is such data
[pictures] => Array
(
[0] => Array
(
[url] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1qn8UHpXXXXcmXXXXXXXXXXXX_!!0-item_pic.jpg
[ismain] => true
[small] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1qn8UHpXXXXcmXXXXXXXXXXXX_!!0-item_pic.jpg_100x100.jpg
[medium] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1qn8UHpXXXXcmXXXXXXXXXXXX_!!0-item_pic.jpg_310x310.jpg
[large] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1qn8UHpXXXXcmXXXXXXXXXXXX_!!0-item_pic.jpg_600x600.jpg
)
[1] => Array
(
[url] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1WyHEGVXXXXbvXFXXXXXXXXXX_!!0-item_pic.jpg
[ismain] => false
[small] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1WyHEGVXXXXbvXFXXXXXXXXXX_!!0-item_pic.jpg_100x100.jpg
[medium] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1WyHEGVXXXXbvXFXXXXXXXXXX_!!0-item_pic.jpg_310x310.jpg
[large] => http://img02.taobaocdn.com/bao/uploaded/i2/TB1WyHEGVXXXXbvXFXXXXXXXXXX_!!0-item_pic.jpg_600x600.jpg
)
[2] => Array
(
[url] => http://img04.taobaocdn.com/bao/uploaded/i4/1852243062/TB2pPS1bFXXXXcuXXXXXXXXXXXX_!!1852243062.jpg
[ismain] => false
[small] => http://img04.taobaocdn.com/bao/uploaded/i4/1852243062/TB2pPS1bFXXXXcuXXXXXXXXXXXX_!!1852243062.jpg_100x100.jpg
[medium] => http://img04.taobaocdn.com/bao/uploaded/i4/1852243062/TB2pPS1bFXXXXcuXXXXXXXXXXXX_!!1852243062.jpg_310x310.jpg
[large] => http://img04.taobaocdn.com/bao/uploaded/i4/1852243062/TB2pPS1bFXXXXcuXXXXXXXXXXXX_!!1852243062.jpg_600x600.jpg
)
[3] => Array
(
[url] => http://img03.taobaocdn.com/bao/uploaded/i3/1852243062/TB2fWFZbpXXXXa_XXXXXXXXXXXX_!!1852243062.jpg
[ismain] => false
[small] => http://img03.taobaocdn.com/bao/uploaded/i3/1852243062/TB2fWFZbpXXXXa_XXXXXXXXXXXX_!!1852243062.jpg_100x100.jpg
[medium] => http://img03.taobaocdn.com/bao/uploaded/i3/1852243062/TB2fWFZbpXXXXa_XXXXXXXXXXXX_!!1852243062.jpg_310x310.jpg
[large] => http://img03.taobaocdn.com/bao/uploaded/i3/1852243062/TB2fWFZbpXXXXa_XXXXXXXXXXXX_!!1852243062.jpg_600x600.jpg
)
[4] => Array
(
[url] => http://img01.taobaocdn.com/bao/uploaded/i1/1852243062/TB2fADTbVXXXXbZXXXXXXXXXXXX_!!1852243062.jpg
[ismain] => false
[small] => http://img01.taobaocdn.com/bao/uploaded/i1/1852243062/TB2fADTbVXXXXbZXXXXXXXXXXXX_!!1852243062.jpg_100x100.jpg
[medium] => http://img01.taobaocdn.com/bao/uploaded/i1/1852243062/TB2fADTbVXXXXbZXXXXXXXXXXXX_!!1852243062.jpg_310x310.jpg
[large] => http://img01.taobaocdn.com/bao/uploaded/i1/1852243062/TB2fADTbVXXXXbZXXXXXXXXXXXX_!!1852243062.jpg_600x600.jpg
)
)
'pictures'][0] ['small']
=$item[Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question