所以我有这个json数据( https://refdev.000webhostapp.com/GetLimiteds.php?userId=21709448)从这里得到它,因为它有点大。
我想获得有限公司的所有名称(在名为Limiteds的数组中)
现在我尝试了类似的东西:
foreach($GetSeller['Limiteds'] as $mydata)
{
echo $mydata[0]['name'];
}
但仅显示3个项目名称。
答案 0 :(得分:0)
@alithedeveloper是对的
<?php
$a = '{"TotalRAP":12143,"Limiteds":[[{"userAssetId":765806854,"serialNumber":null,"assetId":44113968,"name":"Kuddle E. Koala","recentAveragePrice":285,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0},{"userAssetId":800794372,"serialNumber":null,"assetId":15857936,"name":"Tee Vee","recentAveragePrice":659,"originalPrice":45,"assetStock":null,"buildersClubMembershipType":0},{"userAssetId":824837939,"serialNumber":542,"assetId":71499557,"name":"Slithering Slayer","recentAveragePrice":1287,"originalPrice":350,"assetStock":1100,"buildersClubMembershipType":0},{"userAssetId":837503419,"serialNumber":195,"assetId":73151254,"name":"Zombie Fiend","recentAveragePrice":1066,"originalPrice":300,"assetStock":800,"buildersClubMembershipType":0},{"userAssetId":880652082,"serialNumber":null,"assetId":76692214,"name":"Eggcognito Egg","recentAveragePrice":326,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0},{"userAssetId":880682344,"serialNumber":null,"assetId":76692866,"name":"Aqueous Egg of River Riding","recentAveragePrice":257,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0},{"userAssetId":1598993459,"serialNumber":null,"assetId":136217608,"name":"Golden Pilgrim Hat","recentAveragePrice":361,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0}],[],[],[{"userAssetId":762667052,"serialNumber":null,"assetId":20573078,"name":"Shaggy","recentAveragePrice":314,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0},{"userAssetId":2016591111,"serialNumber":null,"assetId":151786902,"name":"Neon Green Beautiful Hair","recentAveragePrice":6756,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0}],[],[],[],[],[{"userAssetId":1648048010,"serialNumber":null,"assetId":140469731,"name":"Festive Narwhal","recentAveragePrice":832,"originalPrice":null,"assetStock":null,"buildersClubMembershipType":0}],[]]}';
$GetSeller = json_decode($a, true);
foreach($GetSeller['Limiteds'] as $mydata){
foreach($mydata as $mydatadata){
echo $mydatadata['name'];
}
}