[請益] stdClass取值

看板PHP作者 (Song6.Lin)時間17年前 (2008/06/01 13:44), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
小弟最近遇到一個奇怪的問題, 想問看看前輩們有什麼好方法解決的? function soap_request($param) { $client = new soapclient(...?WSDL); $ret = $client->call("Add", $param); var_dump($ret); /* 顯示出來的結果: stdClass::__set_state(array( 'Result' => stdClass::__set_state(array( 'string' => array ( 0 => 'Hello', 1 => 'World', 2 => '~!!!!', ), )), )) */ } 我想從$ret中擷取出array中的"Hello", "World", "~!!!!"的字串, 但是$ret是一個stdClass, 我不知道該怎麼抓值orz echo $ret['Result']['string'][0]; 這樣子會顯示錯誤: Fatal error: Cannot use object of type stdClass as array 小弟php初學,可能問題比較怪,還請各位前輩多多包含:p -- ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.217.184.20
文章代碼(AID): #18GZSizL (PHP)
文章代碼(AID): #18GZSizL (PHP)