PHP打印JSON数组在值的顶部显示单词“数组”

Have the following Array that functions perfectly on the site, but before the first output the word "Array" is printed.

I figure it has to be in the $json_object or $fbdata query but cannot isolate or eliminate it from showing.

<?php

$page_id = '{page_id_here}';
$access_token = '{access_token_here}';
//Get the JSON
$json_object = @file_get_contents('https://graph.facebook.com/' . $page_id . 
'/posts?fields=full_picture,link,message&limit=3&access_token=' . 
$access_token);
//Interpret data
$fbdata = json_decode($json_object);

foreach ($fbdata->data as $post )
{
    $posts .= '<div class="col-sm-4">';
        $posts .= '<div class="stay-connected-inner">';
            $posts .= '<div class="stay-connected-info">';
                $posts .= '<div class="stay-connected-left"><i class="fa fa-facebook"></i></div>';
                $posts .= '<div class="stay-connected-right">';
                    $posts .= '<h5>Title</h5>';
                    $posts .= '<p><a href="' . $post->link . '" target="_blank">' . $post->message . '</a></p>';
                $posts .= '</div>';
            $posts .= '</div>';
            $posts .= '<div class="stay-connected-fig">';
                $posts .= '<p><a href="' . $post->link . '" target="_blank"><img src="' . $post->full_picture . '"></a></p>';
            $posts .= '</div>';
        $posts .= '</div>';
    $posts .= '</div>';
}
//Display the posts
print_r ($posts)

?>

Figured it out. I changed my 'posts' variable to 'postst'. The word 'post' was being used in the URL and that seems to have confused the array in some way.

Updated code:

<?php

$page_id = '{page_id_here}';
$access_token = '{access_token_here}';
//Get the JSON
$json_object = @file_get_contents('https://graph.facebook.com/' . $page_id . 
'/posts?fields=full_picture,link,message&limit=3&access_token=' . 
$access_token);
//Interpret data
$fbdata = json_decode($json_object);

foreach ($fbdata->data as $post )
{
$postst .= '<div class="col-sm-4">';
$postst .= '<div class="stay-connected-inner">';
$postst .= '<div class="stay-connected-info">';
$postst .= '<div class="stay-connected-left"><i class="fa fa-facebook"></i></div>';
$postst .= '<div class="stay-connected-right">';
$postst .= '<h5>Title</h5>';
$postst .= '<p><a href="' . $post->link . '" target="_blank">' . $post->message . '</a></p>';
$postst .= '</div>';
$postst .= '</div>';
$postst .= '<div class="stay-connected-fig">';
$postst .= '<p><a href="' . $post->link . '" target="_blank"><img src="' . $post->full_picture . '"></a></p>';
$postst .= '</div>';
$postst .= '</div>';
$postst .= '</div>';
}
//Display the posts
print_r ($postst);

?>

Declare $posts as a String before your foreach loop.

<?php

$page_id = '{page_id_here}';
$access_token = '{access_token_here}';
//Get the JSON
$json_object = @file_get_contents('https://graph.facebook.com/' . $page_id . 
'/posts?fields=full_picture,link,message&limit=3&access_token=' . 
$access_token);
//Interpret data
$fbdata = json_decode($json_object);

$posts = ''; // Add this
foreach ($fbdata->data as $post )
{
    $posts .= '<div class="col-sm-4">';
        $posts .= '<div class="stay-connected-inner">';
            $posts .= '<div class="stay-connected-info">';
                $posts .= '<div class="stay-connected-left"><i class="fa fa-facebook"></i></div>';
                $posts .= '<div class="stay-connected-right">';
                    $posts .= '<h5>Title</h5>';
                    $posts .= '<p><a href="' . $post->link . '" target="_blank">' . $post->message . '</a></p>';
                $posts .= '</div>';
            $posts .= '</div>';
            $posts .= '<div class="stay-connected-fig">';
                $posts .= '<p><a href="' . $post->link . '" target="_blank"><img src="' . $post->full_picture . '"></a></p>';
            $posts .= '</div>';
        $posts .= '</div>';
    $posts .= '</div>';
}
//Display the posts
print_r ($posts)

?>

Otherwise it is making $posts into an array, so when it is printed, it also prints that it's an array.