2015-01-15 4 views
1

나는이 같은 배열의 변수 중 하나를 배열을 읽고 에코하기 위해 노력하고있어 :루프에서 배열을 읽기

foreach($result->http_response_body as $obj) { 
echo $obj->items['address']; 
} 
배열은 다음과 같습니다

내가 그것을 인쇄 :

stdClass Object 
(
[http_response_body] => stdClass Object 
    (
     [total_count] => 1322 
     [items] => Array 
      (
       [0] => stdClass Object 
        (
         [created_at] => Thu, 15 Jan 2015 08:35:06 GMT 
         [tag] => * 
         [id] => 54b77bba55edfbe50e662d3a 
         [address] => [email protected] 
        ) 

       [1] => stdClass Object 
        (
         [created_at] => Thu, 15 Jan 2015 08:34:40 GMT 
         [tag] => * 
         [id] => 54b77ba055edfbe50e662cf6 
         [address] => [email protected] 
        ) 

       [2] => stdClass Object 
        (
         [created_at] => Thu, 15 Jan 2015 08:31:56 GMT 
         [tag] => * 
         [id] => 54b77afc55edfbe50e662b0d 
         [address] => [email protected] 
        ) 
하지만 내 스크립트 내가이 메시지를 HET :

주의 사항 : 라인 27

에 /home/xxxxxxxx/domains/xxxxxxx.xx/public_html/MailGun/watchUnsubscribes.php에 비 객체의 속성을 얻으려고 노력

내가 뭘 잘못 했니?

답변

3

당신이에 코드를 변경해야

foreach ($result->http_response_body->items as $obj) { 
    echo $obj->address; 
} 
-2

대신이 작업을 수행 : 저자는 모든 응답 항목, 바로 첫번째하지 원하는대로

foreach($result->http_response_body->items as $obj) { 
echo (string)$obj->address; 
} 
+0

제공되는 코드는 문제가 해결되지 않습니다 하나. 물론 –

+0

, 주목! –

관련 문제