如何获得单个数组的结果?
嗨,
这是我的数组,它是一个变量,
Array
(
[msg] => Array
(
[0] => Array
(
[alertId] => 2416
[alerttitle] => Raven Lexy
[alertImageUrl] => photos/81951b37ad01c4aa65662956f178214eth.jpeg
[alertDescription] => (1) New Message(s)
[alertType] => New Message
[Date] => 1304679217
[count] => 1
)
)
[rehp] => Array
(
[0] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
[1] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
我想将其转换为
Array
(
[0] => Array
(
[alertId] => 2416
[alerttitle] => Raven Lexy
[alertImageUrl] => photos/81951b37ad01c4aa65662956f178214eth.jpeg
[alertDescription] => (1) New Message(s)
[alertType] => New Message
[Date] => 1304679217
[count] => 1
)
[1] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
[2] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
)
如何使用 foreach 循环/for 循环来获取结果。
谢谢
HI,
this is my array coming in a variable
Array
(
[msg] => Array
(
[0] => Array
(
[alertId] => 2416
[alerttitle] => Raven Lexy
[alertImageUrl] => photos/81951b37ad01c4aa65662956f178214eth.jpeg
[alertDescription] => (1) New Message(s)
[alertType] => New Message
[Date] => 1304679217
[count] => 1
)
)
[rehp] => Array
(
[0] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
[1] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
i want to convert into
Array
(
[0] => Array
(
[alertId] => 2416
[alerttitle] => Raven Lexy
[alertImageUrl] => photos/81951b37ad01c4aa65662956f178214eth.jpeg
[alertDescription] => (1) New Message(s)
[alertType] => New Message
[Date] => 1304679217
[count] => 1
)
[1] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
[2] => Array
(
[alertId] => 48
[alerttitle] => Artin
[alertImageUrl] => photos/95eaf8416ee68981ab944465bcdd7bffth.jpeg
[alertDescription] => Reply From Artin
[alertType] => Reply To Hotpress
[count] => 1
[id] => 48
)
)
how can i use foreach loop/for loop to get the the result.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
怎么样
What about
简单的
foreach
循环并连接数组:Simple
foreach
loop and concatenating the arrays:这有效并且已经过测试:
This works and has been tested: