0

の結果はこちら

print_r($response->Items->Item->EditorialReviews->EditorialReview)

 Array
        (
            [0] => stdClass Object
                (
                    [Source] => Product Description
                    [Content] => Acer AO725-0899
                    [IsLinkSuppressed] => 
                )

            [1] => stdClass Object
                (
                    [Source] => Amazon.com Product Description
                    [Content] => Perfect portability, perfect usability: The Aspire® One AO725 N

0 から Content または 1 から Content の値を取得したいのですが、どうすれば取得できますか?

4

4 に答える 4

1

チェーンをたどってください:

$response->Items->Item->EditorialReviews->EditorialReview[0]->Content

$response->Items->Item->EditorialReviews->EditorialReview[1]->Content

次のようなダンプから必要なデータを見つけるための一般的なルール:

  1. 何でも変数Array( [x] => ...に追加することを意味[0]します。

  2. 何でも変数Object( [x] => ...に追加することを意味->xします。

于 2012-10-12T08:08:47.917 に答える
1
$response->Items->Item->EditorialReviews->EditorialReview[0]->Content
于 2012-10-12T08:08:49.700 に答える
1

簡単に聞こえます:

echo $response->Items->Item->EditorialReviews->EditorialReview[0]->Content;

それらすべてを実行するには:

foreach($response->Items->Item->EditorialReviews->EditorialReview as $review)
   echo $review->Content;
于 2012-10-12T08:09:03.627 に答える
1

これを試して:

echo $response->Items->Item->EditorialReviews->EditorialReview[0]->Content;  //for 0 contect
echo $response->Items->Item->EditorialReviews->EditorialReview[1]->Content;  //for 1 content

$response->Items->Item->EditorialReviews->EditorialReview配列です..値を取得したいインデックスを使用してください...

配列[インデックス];

if object use.... ->yourvalue

于 2012-10-12T08:10:06.290 に答える