问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

PHP 数组值的获取

发布网友 发布时间:2022-04-25 03:36

我来回答

2个回答

热心网友 时间:2023-10-23 15:38

楼上的方法都太傻了 你是看见了这个位置才查找的
很多时候是需要我们自己没看到数组 自己去查找的
我写点小东西 参考下
这是对一个大的数组如何取到自己想要的
$arrProcts = 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 Proction","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 getProctInfo($pcode){
$arrProctinfo = array();
foreach ($this->arrProcts as $key => $value) {
foreach($this->arrProcts[$key] as $key1 => $value1){
if ($pcode == $value1[1]){
$arrProctinfo = $value1;
break;
}
}
}
if (is_array($arrProctinfo)){
return $arrProctinfo;
}
else{
return false;
}
}

热心网友 时间:2023-10-23 15:38

[name] => 3100:
$abc[1][value][name][0][name]

[num] => 24
$abc[1][num]
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
打印机硒鼓安装方法及步骤 如何安装新硒鼓? 我现在很困惑该不该和女友继续发展下去 电脑上字体怎么安装方法简单易行的字体安装步骤及技巧 网页字体显示不出.怎么办? 如何添加电脑上没有的字体解决电脑字体限制增加字体选择多样性_百度知 ... 不有效字体文件 电脑字体识别不了 梦见身上煤炭黑的长辈给我钥匙的预兆 株洲最值得一去的古镇 韩货的牌子有哪些? 求英文小情话,要简短一些。 现代集团的汽车型号 【轩闻联播】华晨65亿债务违约;马斯克或感染新冠 轮回眼有什么用 浩绕柴达木嘎查柴达木社 如何用英文翻译过来啊 山东东营高中生今年几号放寒假 韩国2019年最畅销的十款车,没有一款日系车 轮回眼有什么用? 山东省东平县高级中学什么时候放寒假? HYUNDAI 创立多久了 火影忍者里长门为何会有轮回眼呢? 山东高中生一般农历几号放寒假 《火影忍者》轮回眼的全部能力是什么? 2012年山东省中学生什么时候放寒假 火影忍者里面的轮回眼有什么作用,? 09年山东高中寒假放假时间是几号 轮回眼什么意思 山东高中生大概一月几放寒假?元旦放假吗? 到底“轮回眼”是什么眼睛有什么能力? 现代车和大众车有什么区别 火影忍者中的轮回眼是什么? 求 一女性英文名:带有“ING”的发音;L开头最好 权志龙是唯一有的人 但是到底是什么意思 什么是轮回眼? 英语4级必须是考大学才能考的吗? 车名大全,越多越好 轮回眼是怎么开的 现代企业管理名词解释: 五力模型 轮回眼怎么开 翻译翻译。。 渭城朝雨浥轻尘,客舍青青柳色新翻译成现代汉语怎么翻译? 人机对战有哪些实际意义 酵母是什么? 西方管理发展简史? 请问韩国现代汽车的发动型号有哪些啊?比如伽马,阿尔法什么的 还有别的吗? 现代企业中实施信息化企业战略管理平台管理的意义? 现代管理理论的主要观点是( ) 酵母是什么东西什么样子的? 酵母有几类?