Php 带有json_解码的回声数组提供了太多的回声

Php 带有json_解码的回声数组提供了太多的回声,php,arrays,json,sorting,foursquare,Php,Arrays,Json,Sorting,Foursquare,我确实得到了我想要的条件。但我也得到了json文件中其他数据的第一个字母或数字。 例如,我希望或应该得到以下结果: /巴拉菲纳 这里的烹饪非常棒。这道菜很简单但很好吃。强烈推荐蟹肉丸子、羊肾、串肉和猪脑。这里的雪利酒也很棒。 马特·塔敏/ 但是我得到了 /巴拉菲纳 ee 这里的烹饪非常棒。这道菜很简单但很好吃。强烈推荐蟹肉丸子、羊肾、串肉和猪脑。这里的雪利酒也很棒。 5 E Eu uh 马特·塔敏 / 我做错了什么?代码如下: 如果您有时间和精力查看JSON,您将看到例如5 5 E Eu uh的

我确实得到了我想要的条件。但我也得到了json文件中其他数据的第一个字母或数字。 例如,我希望或应该得到以下结果:

/巴拉菲纳 这里的烹饪非常棒。这道菜很简单但很好吃。强烈推荐蟹肉丸子、羊肾、串肉和猪脑。这里的雪利酒也很棒。 马特·塔敏/

但是我得到了

/巴拉菲纳 ee 这里的烹饪非常棒。这道菜很简单但很好吃。强烈推荐蟹肉丸子、羊肾、串肉和猪脑。这里的雪利酒也很棒。 5 E Eu uh 马特·塔敏 /

我做错了什么?代码如下: 如果您有时间和精力查看JSON,您将看到例如5 5 E Eu uh的来源。 谢谢你的帮助

        <?php
$client_id = 'CLIENT_ID';
$client_secret = 'SECRET';

$request_date = date('Ymd');

$base_url = 'https://api.foursquare.com/v2/';
$endpoint = 'venues/explore?';
$params = 'near=London&limit=3&section=food&radius=1000';
$auth = "&client_id=$client_id&client_secret=$client_secret&v=$request_date";

$url = $base_url.$endpoint.$params.$auth;

$results = file_get_contents($url);

$json_results = json_decode($results,true);
//var_dump($json_results);

$items0 = $json_results['response']['groups']['0']['items']['0'];
$items1 = $json_results['response']['groups']['0']['items']['0']['tips'];
$items2 = $json_results['response']['groups']['0']['items']['0']['tips']['0'];
//<div style="align:center;">
foreach ( $items0+$items1 as $item){
  echo '<li>';
  echo $item['name'];
  echo $item['text'];
}
  foreach ( $items2 as $item){
  print $item['firstName']; print '&nbsp';  print $item['lastName'];
}
这里是JSON

{"meta":{"code":200,"requestId":"55fbde58498e7fdbd12f8fb2"},"response":{"suggestedFilters":{"header":"Tap to show:","filters":[{"name":"With specials","key":"specials"},{"name":"Open now","key":"openNow"}]},"geocode":{"what":"","where":"london","center":{"lat":51.50853,"lng":-0.12574},"displayString":"London, Greater London, United Kingdom","cc":"GB","geometry":{"bounds":{"ne":{"lat":51.691643999655895,"lng":0.33418999705203406},"sw":{"lat":51.28467404417054,"lng":-0.5085579279369435}}},"slug":"london","longId":"72057594040571679"},"warning":{"text":"There aren't a lot of results near you. Try something more general, reset your filters, or expand the search area."},"headerLocation":"London","headerFullLocation":"London","headerLocationGranularity":"city","query":"food","totalResults":246,"suggestedBounds":{"ne":{"lat":51.5108003587992,"lng":-0.12174369837640672},"sw":{"lat":51.50810069901375,"lng":-0.1301527846860385}},"groups":[{"type":"Recommended Places","name":"recommended","items":[{"reasons":{"count":0,"items":[{"summary":"This spot is popular","type":"general","reasonName":"globalInteractionReason"}]},"venue":{"id":"53bab96d498e7e355fb53d6c","name":"Barrafina","contact":{"phone":"+442074401456","formattedPhone":"+44 20 7440 1456","twitter":"barrafinaadst","facebook":"705351912878392","facebookUsername":"BarrafinaAdelaideStreet","facebookName":"Barrafina Adelaide Street"},"location":{"address":"10 Adelaide St","crossStreet":"William IV St","lat":51.50945052890648,"lng":-0.1259482415312226,"postalCode":"WC2N 4HZ","cc":"GB","city":"London","state":"Greater London","country":"United Kingdom","formattedAddress":["10 Adelaide St (William IV St)","London","Greater London","WC2N 4HZ","United Kingdom"]},"categories":[{"id":"4bf58dd8d48988d150941735","name":"Spanish Restaurant","pluralName":"Spanish Restaurants","shortName":"Spanish","icon":{"prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/spanish_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":357,"usersCount":278,"tipCount":26},"url":"http:\/\/barrafina.co.uk","rating":9.0,"ratingColor":"00B551","ratingSignals":80,"allowMenuUrlEdit":true,"hours":{"status":"Closed until Noon","isOpen":false},"specials":{"count":0,"items":[]},"photos":{"count":31,"groups":[]},"hereNow":{"count":0,"summary":"Nobody here","groups":[]}},"tips":[{"id":"55db9142498ede18f5b31b81","createdAt":1440452930,"text":"Exceptional cooking here. Such simple but amazing dishes. Highly recommend the crab croquettes, lambs kidneys, skewers and the brain. Sherries are also superb here.","type":"user","canonicalUrl":"https:\/\/foursquare.com\/item\/55db9142498ede18f5b31b81","likes":{"count":2,"groups":[],"summary":"2 likes"},"logView":true,"todo":{"count":0},"user":{"id":"98683884","firstName":"Matt","lastName":"Ta-Min","gender":"male","photo":{"prefix":"https:\/\/irs1.4sqi.net\/img\/user\/","suffix":"\/98683884-1MJ0OTISTPZWSBRJ.jpg"}}}],"referralId":"e-3-53bab96d498e7e355fb53d6c-0"}]}]}}

我希望看到JSON,因为我有时间和精力,但不幸的是我没有看到JSON:=>{meta:{code:400,errorType:invalid\u auth,errorDetail:Missing access credentials。有关详细信息,请参阅https:\/\/developer.foursquare.com\/docs\/oauth.html。},响应:{}需要查看您实际使用的JSON,如果您可以使用var_dump$json_results的结果编辑您的问题,这将更加有用;出口在第17行右侧未注释编辑并添加JSON@Mik_A:数组合并$items0+$items1是否有问题。。请记住,如果两个数组中都存在数组键,则将使用第一个数组中的元素,而忽略第二个数组中匹配键的元素。您可以尝试先对合并的数组进行var_转储,以查看是否可以发现意外情况。
{"meta":{"code":200,"requestId":"55fbde58498e7fdbd12f8fb2"},"response":{"suggestedFilters":{"header":"Tap to show:","filters":[{"name":"With specials","key":"specials"},{"name":"Open now","key":"openNow"}]},"geocode":{"what":"","where":"london","center":{"lat":51.50853,"lng":-0.12574},"displayString":"London, Greater London, United Kingdom","cc":"GB","geometry":{"bounds":{"ne":{"lat":51.691643999655895,"lng":0.33418999705203406},"sw":{"lat":51.28467404417054,"lng":-0.5085579279369435}}},"slug":"london","longId":"72057594040571679"},"warning":{"text":"There aren't a lot of results near you. Try something more general, reset your filters, or expand the search area."},"headerLocation":"London","headerFullLocation":"London","headerLocationGranularity":"city","query":"food","totalResults":246,"suggestedBounds":{"ne":{"lat":51.5108003587992,"lng":-0.12174369837640672},"sw":{"lat":51.50810069901375,"lng":-0.1301527846860385}},"groups":[{"type":"Recommended Places","name":"recommended","items":[{"reasons":{"count":0,"items":[{"summary":"This spot is popular","type":"general","reasonName":"globalInteractionReason"}]},"venue":{"id":"53bab96d498e7e355fb53d6c","name":"Barrafina","contact":{"phone":"+442074401456","formattedPhone":"+44 20 7440 1456","twitter":"barrafinaadst","facebook":"705351912878392","facebookUsername":"BarrafinaAdelaideStreet","facebookName":"Barrafina Adelaide Street"},"location":{"address":"10 Adelaide St","crossStreet":"William IV St","lat":51.50945052890648,"lng":-0.1259482415312226,"postalCode":"WC2N 4HZ","cc":"GB","city":"London","state":"Greater London","country":"United Kingdom","formattedAddress":["10 Adelaide St (William IV St)","London","Greater London","WC2N 4HZ","United Kingdom"]},"categories":[{"id":"4bf58dd8d48988d150941735","name":"Spanish Restaurant","pluralName":"Spanish Restaurants","shortName":"Spanish","icon":{"prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/spanish_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":357,"usersCount":278,"tipCount":26},"url":"http:\/\/barrafina.co.uk","rating":9.0,"ratingColor":"00B551","ratingSignals":80,"allowMenuUrlEdit":true,"hours":{"status":"Closed until Noon","isOpen":false},"specials":{"count":0,"items":[]},"photos":{"count":31,"groups":[]},"hereNow":{"count":0,"summary":"Nobody here","groups":[]}},"tips":[{"id":"55db9142498ede18f5b31b81","createdAt":1440452930,"text":"Exceptional cooking here. Such simple but amazing dishes. Highly recommend the crab croquettes, lambs kidneys, skewers and the brain. Sherries are also superb here.","type":"user","canonicalUrl":"https:\/\/foursquare.com\/item\/55db9142498ede18f5b31b81","likes":{"count":2,"groups":[],"summary":"2 likes"},"logView":true,"todo":{"count":0},"user":{"id":"98683884","firstName":"Matt","lastName":"Ta-Min","gender":"male","photo":{"prefix":"https:\/\/irs1.4sqi.net\/img\/user\/","suffix":"\/98683884-1MJ0OTISTPZWSBRJ.jpg"}}}],"referralId":"e-3-53bab96d498e7e355fb53d6c-0"}]}]}}