2015-08-09 60 views
0

如何訪問以下stdclass,並且echo事務ID已被使用。在PHP中獲取stdclass和數組值

object(stdClass)#2 (1) { 
    ["SendBulkSMS_PHPResult"]=> 
    object(stdClass)#3 (1) { 
    ["string"]=> 
    array(3) { 
     [0]=> 
     string(1) "0" 
     [1]=> 
     string(37) "Transaction ID has already been used." 
     [2]=> 
     NULL 
    } 
    } 
} 
+1

這可以幫助你:http://stackoverflow.com/questions/3851489/return-php-object-by-index- number-not-name –

回答

0

從它的外觀,這將是:

$object->SendBulkSMS_PHPResult->string[1]; 
+0

如果在上面嘗試,它不起作用,而做$ response-> SendBulkSMS_PHPResult-> string [1];幫助並返回了stdclass的實際價值 – wicky

+0

謝謝:-)反正它有幫助。 – wicky