【发布时间】:2012-08-03 05:57:43
【问题描述】:
当我运行 SOAP 客户端时,我得到以下响应。
如何在 php 中解析这个结构?我只想取NUGGETNAME 的值。
如何计算结果的长度?
object(stdClass)#2 (1) {
["GetHotelNuggetResult"]=>
object(stdClass)#3 (1) {
["HotelNugget"]=>
array(9) {
[0]=>
object(stdClass)#4 (7) {
["NUGGETNAME"]=>
string(19) "Yaz Tatili Otelleri"
["NUGGETORDER"]=>
string(2) "10"
["PARENTUNIQUECODE"]=>
string(10) "AS_SOL_UST"
["REWRITENUGGETNAME"]=>
string(19) "yaz-tatili-otelleri"
["TITLE"]=>
string(19) "Yaz Tatili Otelleri"
["UNIQUECODE"]=>
string(5) "YTOTL"
["WEBNUGGETID"]=>
int(306)
}
.......//other results
}
}
【问题讨论】:
-
定义解析?您有一些不错的对象,那么您还想用它做什么?
-
我想在屏幕上打印 NUGGETNAME 的值。
-
$obj->PropertyName这是您可以在 php 中访问对象属性的方式。
标签: php parsing object stdclass