2013-11-22 49 views
-1

我需要參考各組件的喜歡,消息價格...等如何引用類對象在PHP

stdClass Object ( 
    [message-count] => 1 

    [messages] => Array ( 
     [0] => stdClass Object ( 
      [to] => 256754106703 
      [message-price] => 0.00700000 
      [status] => 0 
      [message-id] => 020000001AF86AE5 
      [remaining-balance] => 1.80010000 
      [network] => 64101 
     ) 
    ) 
) 

我該怎麼辦呢?

+0

'$ myClassObject->消息[0] - > id'; '$ myClassObject->消息[0] - > { '消息價格'}'; '$ myClassObject->消息[0] - > network'; etc –

+0

@MarkBaker幹得好,就是我需要的 – Beraki

回答

2

做:

echo $yourObj->messages[0]->{'message-price'};