PHP 数组值的获取

$abc=Array([0]=>Array([value]=>Array([name]=>Array([0]=>Array([name]=>2180[moye]=>400... $abc=Array ( [0] => Array ( [value] => Array ( [name] => Array ( [0] => Array ( [name] => 2180 [moye] => 400 ) ) [gameid] => 1 ) [num] => 3 )
[1] => Array ( [value] => Array ( [name] => Array ( [0] => Array ( [name] => 3100 [moye] => 500 ) ) [gameid] => 2 ) [num] => 24 ) )

我要从这个数组总拿到 [name] => 3100或者[num] => 24 应该怎么拿呢?
展开
 我来答
zenggan219
2008-11-19 · 超过15用户采纳过TA的回答
知道答主
回答量:61
采纳率:0%
帮助的人:47.9万
展开全部
楼上的方法都太傻了 你是看见了这个位置才查找的
很多时候是需要我们自己没看到数组 自己去查找的
我写点小东西 参考下
这是对一个大的数组如何取到自己想要的
$arrProducts = array (
"bag" => array( array("Louis Vuitton","1","LV Mono Motard Biker-Limited","3800.00",'2911.00','a','lv001.jpg'),
array("Louis Vuitton","2"," LV Monogram Rubis Neo Bucket~Limited~Cruise Collection","1944.00",'1500.00','a','lv002.jpg'),
array("Louis Vuitton","3","LV Multicolor Speedy(White)","1867.00",'1333.00','a','lv003.jpg'),
array("Louis Vuitton","4","LV Monogram Reverter-Limited","1666.00",'1311.00','a','lv004.jpg'),
array("Louis Vuitton","5","LV Monogram Perforations Speedy","0.00",'1111.00','a','lv005.jpg'),
array("Louis Vuitton","6","LV Multicolor Speedy","1866.00",'1067.00','a','lv006.jpg'),
array("Louis Vuitton","7","LV Taiga Kendall GM Ardoise-M30112","1711.00",'1044.00','a','lv007.jpg'),
array("Louis Vuitton","8","LV Multicolor Lodge GM","1822.00",'933.00','a','lv008.jpg'),
array("Louis Vuitton","9","LV Mat Leather Handbag +Wallet","0.00",'889.00','a','lv009.jpg'),
array("Louis Vuitton","10","LV Monogram Tulum GM","1444.00",'889.00','a','lv010.jpg'),

array("Louis Vuitton","11"," LV Taiga Dersou~M30162","1322.00",'878.00','a','lv011.jpg'),
array("Louis Vuitton","12","LV Monogram Denim Baggy PM -M95049-Limited Color~明星袋","1155.00",'864.00','a','lv012.jpg'),
array("Louis Vuitton","13","LV Globe Shopper Cabas Tote Bag-Limited~明星袋","1278.00",'833.00','a','lv013.jpg'),
array("Louis Vuitton","14","LV Denim Sac a dos GM","1422.00",'756.00','a','lv014.jpg'),
array("Louis Vuitton","15","LV Monogram Cruiser 45","1567.00",'733.00','a','lv015.jpg'),
array("Louis Vuitton","16","LV Damier Azur Seleya MM","978.00",'733.00','a','lv016.jpg'),
array("Louis Vuitton","17","LV Mini Lin Mary Kate~Stop Production","1011.00",'656.00','a','lv017.jpg'),
array("Louis Vuitton","18","LV Damier Triana-N51155","1300.00",'656.00','a','lv018.jpg'),
array("Louis Vuitton","19","LV Monogram Luco","1422.00",'756.00','a','lv019.jpg'),
array("Louis Vuitton","20","LV Monogram LucoLV Damier Tribeca Long~N51160","1044.00",'598.00','a','lv020.jpg'),
array("Louis Vuitton","21","LV Vernis Sunset Boulevard","711.00",'576.00','a','lv021.jpg'),
array("Louis Vuitton","22"," LV Vernis Thompson Street-M91008","1022.00",'556.00','a','lv022.jpg'),
array("Louis Vuitton","23","LV Suede Perforated Onatah-Limited","844.00",'511.00','a','lv023.jpg'),
array("Louis Vuitton","24","LV Monogram Messenger PM Bosphore","689.00",'487.00','a','lv024.jpg'),

array("Dior","25","Dior bag ","",'','a','Dior01.jpg'),
array("Dior","26","Dior bag ","",'','a','Dior02.jpg'),
array("Dior","27","Dior bag ","",'','a','Dior03.jpg'),
array("Dior","28","Dior bag ","",'','a','Dior04.jpg'),
array("Dior","29","Dior bag ","",'','a','Dior05.jpg'),
array("Dior","30","Dior bag ","",'','a','Dior06.jpg'),
array("Dior","31","Dior bag ","",'','a','Dior07.jpg'),
array("Dior","32","Dior bag ","",'','a','Dior08.jpg'),
array("Dior","33","Dior bag ","",'','a','Dior09.jpg'),
array("Dior","34","Dior bag ","",'','a','Dior10.jpg'),
array("Dior","35","Dior bag ","",'','a','Dior11.jpg'),
array("Dior","36","Dior bag ","",'','a','Dior12.jpg'),
array("Dior","37","Dior bag ","",'','a','Dior13.jpg'),
array("Dior","38","Dior bag ","",'','a','Dior14.jpg'),
array("Dior","39","Dior bag ","",'','a','Dior15.jpg'),
array("Dior","40","Dior bag ","",'','a','Dior16.jpg'),
array("Dior","41","Dior bag ","",'','a','Dior17.jpg'),
array("Dior","42","Dior bag ","",'','a','Dior18.jpg'),
array("Dior","43","Dior bag ","",'','a','Dior19.jpg'),
array("Dior","44","Dior bag ","",'','a','Dior20.jpg'),

array("Chanel","45","Chanel Cambon Tote ","1287.00",'878.00','a','cha001.jpg'),
array("Chanel","46","Chanel Handbag~Limited ","1556.00",'878.00','a','cha002.jpg'),
array("Chanel","47","Chanel Rabbit Fur Hangbag-Limited ","1667.00",'778.00','a','cha003.jpg'),
array("Chanel","48","Chanel Backpack(Suede) ","1333.00",'529.00','a','cha004.jpg'),
array("Chanel","49","Chanel Canvas Shopper Bag ","867.00",'529.00','a','cha005.jpg'),
array("Chanel","50","Chanel Satin Dinner Bag~绸缎晚宴包 ","0.00",'529.00','a','cha006.jpg'),
array("Chanel","51","Chanel Dinner Bag-Limited ","0.00",'511.00','a','cha007.jpg'),
array("Chanel","52","Chanel Vintage Velvet Bag ","0.00",'444.00','a','cha008.jpg'),
array("Chanel","53","Chanel Backpack ","0.00",'444.00','a','cha009.jpg'),
array("Chanel","54","Chanel ","0.00",'433.00','a','cha010.jpg'),
array("Chanel","55","Chanel Waist Bag ","1067.00",'353.00','a','cha011.jpg'),
array("Chanel","56","Chanel Travel Line Unisex Sling Bag(Canvas)","0.00",'289.00','a','cha012.jpg'),
array("Chanel","57","Chanel ","889.00",'284.00','a','cha013.jpg'),
array("Chanel","58","Chanel Shoulder Bag","0.00",'244.00','a','cha014.jpg'),

array("Prada","59","Prada Gaufre Bag(white)","1178.00",'656.00','a','pra001.jpg'),
array("Prada","60","Prada Full Leather Handbag","744.00",'367.00','a','pra002.jpg'),
array("Prada","61","Prada Shoulder Bag(Nylon)","0.00",'331.00','a','pra003.jpg'),
array("Prada","62","Prada Handbag/Sling Bag","578.00",'307.00','a','pra004.jpg'),
array("Prada","63","Prada Backpack(Nylon)","0.00",'287.00','a','pra005.jpg'),
array("Prada","64","Prada Sling Bag(Nylon)","422.00",'198.00','a','pra006.jpg'),
array("Prada","65","Prada nylon white black leather shoulder","844.00",'176.00','a','pra007.jpg'),
array("Prada","66","Prada Soulder Bag","347.00",'156.00','a','pra008.jpg'),
array("Prada","67","Prada Soulder Bag","0.00",'133.00','a','pra009.jpg'),
array("Prada","68","Prada Nylon Sling Bag","244.00",'108.00','a','pra010.jpg'),
array("Prada","69","Prada Nylon Shoulder Bag-NETT PRICE ","0.00",'107.00','a','pra011.jpg'),

array("Hermes","70","Hermes Birkin Bag-25cm-小公牛皮材质 Calf Skin-银色扣式","0.00",'7111.00','a','her001.jpg'),
array("Hermes","71","Hermes Bolide 31","4778.00",'3067.00','a','her002.jpg'),
array("Hermes","72","Hermes Her Bag ","0.00",'878.00','a','her003.jpg'),
array("Hermes","73","Hermes Scarf ","340.00",'178.00','a','her004.jpg'),

array("Gucci","74","Gucci Signoria Dome ","1509.00",'733.00','a','guc001.jpg'),
array("Gucci","75","Gucci Full Leather Perforated Shoulder Bag ","1144.00",'589.00','a','guc002.jpg'),
array("Gucci","76","Gucci 07 Bouvier Jackie bag","733.00",'531.00','a','guc003.jpg'),
array("Gucci","77","Gucci Handbag(Suede Leather) ","0.00",'444.00','a','guc004.jpg'),
array("Gucci","78","Gucci Evening Bag with Stone~Limited","0.00",'422.00','a','guc005.jpg'),
array("Gucci","79","Gucci Crystal joy Boston Bag(Size:L38W21H25cm) ","0.00",'398.00','a','guc006NEW.jpg'),
array("Gucci","80","Gucci pink colour sling bag ","611.00",'373.00','a','guc006.jpg'),
array("Gucci","81","Gucci Sholder Bag with silver strap ","756.00",'367.00','a','guc007.jpg'),
array("Gucci","82","Gucci Tote Bag","656.00",'367.00','a','guc008.jpg'),
array("Gucci","83","Gucci Shoulder Bag ","678.00",'353.00','a','guc009.jpg'),
array("Gucci","84","Gucci GG Logo Canvas with red leather strap","733.00",'329.00','a','guc010.jpg'),
array("Gucci","85","Gucci Sling Bag ","0.00",'309.00','a','guc011.jpg'),
array("Gucci","86","Gucci Canvas Sling Bag ","589.00",'309.00','a','guc012.jpg'),
array("Gucci","87","Gucci Shoulder Bag(wooden) ","0.00",'289.00','a','guc013.jpg'),
array("Gucci","88","Gucci Shoulder Bag(Black Canvas) ","0.00",'287.00','a','guc014NEW.jpg'),
array("Gucci","89","Gucci Sling Bag(waterproof) ","667.00",'267.00','a','guc014.jpg'),
array("Gucci","90","Gucci Shopping Bag ","333.00",'256.00','a','guc015.jpg'),
array("Gucci","91","Gucci Canvas Black Shoulder Bag ","622.00",'195.00','a','guc016.jpg'),
array("Gucci","92","Gucci Shoulder Bag ","0.00",'155.00','a','guc017.jpg'),
array("Gucci","93","Gucci Handbag ","0.00",'144.00','a','guc018.jpg'),
array("Gucci","94","Gucci Pink Dinner Bag ","289.00",'133.00','a','guc019.jpg'),
array("Gucci","95","Gucci Shoulder Bag ","0.00",'111.00','a','guc020.jpg'),
array("Gucci","96","Gucci Canvas Sling Bag ","0.00",'109.00','a','guc021.jpg'),
array("Gucci","97","Gucci Sling Bag ","0.00",'109.00','a','guc022.jpg'),
array("Gucci","98","Gucci Utilities Box ","0.00",'89.00','a','guc023.jpg'),
array("Gucci","99","Gucci Porchette ","244.00",'62.00','a','guc024.jpg'),
array("Gucci","100","Gucci Wallet ","0.00",'37.00','a','guc025.jpg'),

),

"watch" => array( array("Cartier","101","CARTIER MINI TONNEAU (SOLD)","1.00",'0.01','a','cart01s.jpg'),
array("Cartier","102","CARTIER PASHA 18K YELLOW GOLD","1.00",'0.01','a','cart02s.jpg'),
array("Cartier","103","CARTIER PASHA C (SOLD)","1.00",'0.01','a','cart03s.jpg'),
array("Cartier","104","CARTIER PASHA CHRONOGRAPH","1.00",'0.01','a','cart04s.jpg'),
array("Cartier","105","CARTIER PASHA CHRONOGRAPH (SOLD)","1.00",'0.01','a','cart05s.jpg'),
array("Cartier","106","CARTIER PASHA CHRONOGRAPH (SOLD)","1.00",'0.01','a','cart06s.jpg'),
array("Cartier","107","CARTIER ROADSTER","1.00",'0.01','a','cart07s.jpg'),
array("Cartier","108","CARTIER ROADSTER (SOLD)","1.00",'0.01','a','cart08s.jpg'),
array("Cartier","109","CARTIER ROADSTER (SOLD)","1.00",'0.01','a','cart09s.jpg'),
array("Cartier","110","CARTIER SANTOS 100 (SOLD)","1.00",'0.01','a','cart10s.jpg'),
array("Cartier","111","CARTIER SANTOS 100 CHRONO STEEL/GOLD","1.00",'0.01','a','cart11s.jpg'),
array("Cartier","112","CARTIER SANTOS DE CARTIER (SOLD)","1.00",'0.01','a','cart12s.jpg'),
array("Cartier","113","CARTIER TANK AMERICAINE (SOLD)","1.00",'0.01','a','cart13s.jpg'),
array("Cartier","114","CARTIER TANK DIVAN","1.00",'0.01','a','cart14s.jpg'),
array("Cartier","115","CARTIER TANK FRANCAISE","1.00",'0.01','a','cart15s.jpg'),

array("Chopard","116","CHOPARD DUAL TIME ZONE (SOLD)","1.00",'0.01','a','cho01s.jpg'),
array("Chopard","117","CHOPARD HAPPY DIAMOND","1.00",'0.01','a','cho02s.jpg'),
array("Chopard","118","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho03s.jpg'),
array("Chopard","119","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho04s.jpg'),
array("Chopard","120","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho05s.jpg'),
array("Chopard","121","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho06s.jpg'),
array("Chopard","122","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho07s.jpg'),
array("Chopard","123","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho08s.jpg'),
array("Chopard","124","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho09s.jpg'),
array("Chopard","125","CHOPARD HAPPY DIAMOND (SOLD))","1.00",'0.01','a','cho10s.jpg'),

array("Chopard","126","CHOPARD L.U.C 3.96 (LIMITED)","1.00",'0.01','a','cho11s.jpg'),
array("Chopard","127","CHOPARD MILLE MIGLIA GMT (SOLD)","1.00",'0.01','a','cho12s.jpg'),
array("Chopard","128","CHOPARD MILLE MIGLIA SPLIT SECOND (SOLD)","1.00",'0.01','a','cho13s.jpg'),
array("Chopard","129","CHOPARD POWER RESERVE WHITE GOLD","1.00",'0.01','a','cho14s.jpg'),
array("Chopard","130","CHOPARD SKELETONISED (SOLD)","1.00",'0.01','a','cho15s.jpg'),

array("Piaget","131","PIAGET DANCER (SOLD)","1.00",'0.01','a','pia01s.jpg'),
array("Piaget","132","PIAGET MISS PROTOCOLE","1.00",'0.01','a','pia02s.jpg'),
array("Piaget","133","CHOPARD POWER RESERVE WHITE GOLD","1.00",'0.01','a','pia03s.jpg'),
array("Piaget","134","PIAGET WHITE GOLD","1.00",'0.01','a','pia04s.jpg'),
array("Piaget","135","PIAGET WHITE GOLD","1.00",'0.01','a','pia05s.jpg'),
array("Piaget","136","PIAGET WHITE GOLD","1.00",'0.01','a','pia06s.jpg'),

array("Girard-Perregaux","137","GIRARD PERREGAUX CAT'S EYE (SOLD)","1.00",'0.01','a','gp01s.jpg'),
array("Girard-Perregaux","138","GIRARD PERREGAUX F1-2000","1.00",'0.01','a','gp02s.jpg'),
array("Girard-Perregaux","139","GIRARD PERREGAUX FEAT. FERRARI","1.00",'0.01','a','gp03s.jpg'),
array("Girard-Perregaux","140","GIRARD PERREGAUX VINTAGE 1970 CHRONOGRAPH","1.00",'0.01','a','gp04s.jpg'),
array("Girard-Perregaux","141","GP BMW ORACLE SEA HAWK USA-71 (SOLD)","1.00",'0.01','a','gp05s.jpg'),

array("Rolex","142","ROLEX 116234 (SOLD)","1.00",'0.01','a','rol01s.jpg'),
array("Rolex","143","ROLEX 116710 (SOLD)","1.00",'0.01','a','rol02s.jpg'),
array("Rolex","144","ROLEX 16233G (SOLD)","1.00",'0.01','a','rol03s.jpg'),
array("Rolex","145","ROLEX 16234G","1.00",'0.01','a','rol04s.jpg'),
array("Rolex","146","ROLEX 178240 (SOLD)","1.00",'0.01','a','rol05s.jpg'),
array("Rolex","147","ROLEX 178273G (SOLD)","1.00",'0.01','a','rol06s.jpg'),
array("Rolex","148","ROLEX 179159 (SOLD)","1.00",'0.01','a','rol07s.jpg'),
array("Rolex","149","ROLEX 179171G (SOLD)","1.00",'0.01','a','rol08s.jpg'),
array("Rolex","150","ROLEX 179173G (SOLD)","1.00",'0.01','a','rol09s.jpg'),
array("Rolex","151","ROLEX 179175 (SOLD)","1.00",'0.01','a','rol10s.jpg'),
array("Rolex","152","ROLEX 1803","1.00",'0.01','a','rol11s.jpg'),
array("Rolex","153","ROLEX 18238 (SOLD)","1.00",'0.01','a','rol12s.jpg'),
array("Rolex","154","ROLEX 18239MA (SOLD)","1.00",'0.01','a','rol13s.jpg'),
array("Rolex","155","ROLEX 19018","1.00",'0.01','a','rol14s.jpg'),
array("Rolex","156","ROLEX 68273G (SOLD)","1.00",'0.01','a','rol15s.jpg'),

)
);

?>
//根据产品编号,取出此商品的详细信息
//数组对应的值,参见config.php
function getProductInfo($pcode){
$arrProductinfo = array();
foreach ($this->arrProducts as $key => $value) {
foreach($this->arrProducts[$key] as $key1 => $value1){
if ($pcode == $value1[1]){
$arrProductinfo = $value1;
break;
}
}
}
if (is_array($arrProductinfo)){
return $arrProductinfo;
}
else{
return false;
}
}
辉煌kind
2008-11-19 · TA获得超过1484个赞
知道小有建树答主
回答量:751
采纳率:0%
帮助的人:764万
展开全部
[name] => 3100:
$abc[1][value][name][0][name]

[num] => 24
$abc[1][num]
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式