Array
(
[found] => Array
(
[0] => Array
(
[id] => 1400
[name] => ?¨?§?³U… U?Uˆ?³U? ?´Uˆ ?§U„?ÂU„U‚?© ?§U„?³?§?¯?³?© - ?¬Uˆ?¯?© ?¹?§U„U??© ?±Uˆ?§?¨?· U…?¨?§?´?±?©
[visits] => 46
[shortdes] => ?¨?§?³U… U?Uˆ?³U? ?´Uˆ ?§U„?ÂU„U‚?© ?§U„?³?§?¯?³?© - ?¬Uˆ?¯?© ?¹?§U„U??© ?±Uˆ?§?¨?· U…?¨?§?´?±?© - ???ÂU…U?U„ U…?¨?§?´?± ?¹U„U‰ ?§UÆ’?«?± U…U†?³U??±U??±
[photo] => http://www.msrstars.com/up//uploads/images/msrstars.com63451f7ada.jpg
)
[1] => Array
(
[id] => 1399
[name] => U…U‚?§?±U†?© ?¨U?U†?§U„?µUˆ?± ?§U„??U‰ ?§?³???¹?·U? ?¨U‡?§ ?§U„U?U‡Uˆ?¯ ?§U„?¹?§U„U… ?¨?§?«?±U‡ :: Uˆ?§U„?´?¹?¨ ?§U„U?U„?³?·U?U†U‰ U??�¯?« U…?¹?§U‡ U†U??³ ?§U„?§?�¯?§?« UˆU„UƒU†U„?§ ?§?�¯ U????�±Uƒ
[visits] => 56
[shortdes] => U…U‚?§?±U†?© ?¨U?U†?§U„?µUˆ?± ?§U„??U‰ ?§?³???¹?·U? ?¨U‡?§ ?§U„U?U‡Uˆ?¯ ?§U„?¹?§U„U… ?¨?§?«?±U‡ :: Uˆ?§U„?´?¹?¨ ?§U„U?U„?³?·U?U†U‰ U??�¯?« U…?¹?§U‡ U†U??³ ?§U„?§?�¯?§?« UˆU„UƒU†U„?§ ?§?�¯ U????�±Uƒ
[photo] => http://www.msrstars.com/up/uploads/images/msrstars.com3a442679e4.jpg
)
我想要获取
[id] => 1400
[name] => ?¨?§?³U… U?Uˆ?³U? ?´Uˆ ?§U„?ÂU„U‚?© ?§U„?³?§?¯?³?© - ?¬Uˆ?¯?© ?¹?§U„U??© ?±Uˆ?§?¨?· U…?¨?§?´?±?©
[visits] => 46
[shortdes] => ?¨?§?³U… U?Uˆ?³U? ?´Uˆ ?§U„?ÂU„U‚?© ?§U„?³?§?¯?³?© - ?¬Uˆ?¯?© ?¹?§U„U??© ?±Uˆ?§?¨?· U…?¨?§?´?±?© - ???ÂU…U?U„ U…?¨?§?´?± ?¹U„U‰ ?§UÆ’?«?± U…U†?³U??±U??±
[photo] => http://www.msrstars.com/up//uploads/images/msrstars.com63451f7ada.jpg
并将其列为
list($id,$name,$visits,$shortdes,$photo)
所以对于那个例子我echo $id;
它提供了1400
答案 0 :(得分:0)
您可以使用extract:
foreach ($array['found'] as $value) {
extract($value);
echo $id;
}
但是你应该直接访问数组索引,而不是在代码中注入变量。毕竟,这就是数组的用途:
foreach ($array['found'] as $value) {
echo $value['id'];
}