1

如何从这种对象中提取单个数据?

tabs\api\property\Property Object ( 
    [id:protected] => 90_4_HH 
    [propertyRef:protected] => 90_4 
    [brandCode:protected] => HH 
    [url:protected] => http://hh.api.carltonsoftware.co.uk/property/90_4_HH
    [accountingBrand:protected] => HH 
    [slug:protected] => 90-4-hh 
    [name:protected] => Carreg Lwyd Farmhouse 
    [address:protected] => tabs\api\core\Address Object ( 
        [addr1:protected] => Port Eynon 
        [addr2:protected] => 
        [town:protected] => Gower 
        [county:protected] => Swansea 
        [postcode:protected] => SA3 1NN 
        [country:protected] => GB 
    ) 
    [changeOverDay:protected] => Saturday 
    [calendar:protected] => http://hh.api.carltonsoftware.co.uk/property/90_4_HH/calendar 
    [booking:protected] => http://hh.api.carltonsoftware.co.uk/booking 
    [pets:protected] => 
    [promote:protected] => 
    [smoking:protected] => 
    [shortlist:protected] => 
    [accommodates:protected] => 12 
    [rating:protected] => 5 
    [bedrooms:protected] => 6 
    [images:protected] => Array ( 
        [90_4p1190276.jpg?APIKEY=homefromhome&hash=31b3f7b1b377184e8cb8fb64d434a11a4c3446c1091535ef6db4e119689a6372] => tabs\api\property\Image Object ( 
            [filename:protected] => 90_4p1190276.jpg?APIKEY=homefromhome&hash=31b3f7b1b377184e8cb8fb64d434a11a4c3446c1091535ef6db4e119689a6372 
            [title:protected] => Carreg Lwyd Farmhouse, Port Eynon 
            [alt:protected] => The Lounge 
            [url:protected] => http://hh.api.carltonsoftware.co.uk/image/normal/1000x750/90_4p1190276.jpg 
            [height:protected] => 750 
            [width:protected] => 1000 
            [apiPath:protected] => http://hh.api.carltonsoftware.co.uk 
        ) 
        [90_4img_4819.jpg?APIKEY=homefromhome&hash=31b3f7b1b377184e8cb8fb64d434a11a4c3446c1091535ef6db4e119689a6372] => tabs\api\property\Image Object ( 
            [filename:protected] => 90_4img_4819.jpg?APIKEY=homefromhome&hash=31b3f7b1b377184e8cb8fb64d434a11a4c3446c1091535ef6db4e119689a6372 
            [title:protected] => Carreg Lwyd Farmhouse, Port Eynon 
            [alt:protected] => Dining Room 
            [url:protected] => http://hh.api.carltonsoftware.co.uk/image/normal/1000x667/90_4img_4819.jpg 
            [height:protected] => 667 
            [width:protected] => 1000 
            [apiPath:protected] => http://hh.api.carltonsoftware.co.uk 
        ) 
        [90_4p1210779.jpg?APIKEY=homefromhome&hash=31b3f7b1b377184e8cb8fb64d434a11a4c3446c1091535ef6db4e119689a6372] => tabs\api\property\Image Object ( 
            [filename:protected] => 90_4p1210779.jpg?APIKEY=homefromhome&hash=31b3f7b1b377184e8cb8fb64d434a11a4c3446c1091535ef6db4e119689a6372 
            [title:protected] => Carreg Lwyd Farmhouse, Port Eynon 
            [alt:protected] => The Farmhouse 
            [url:protected] => http://hh.api.carltonsoftware.co.uk/image/normal/1000x750/90_4p1210779.jpg 
            [height:protected] => 750 
            [width:protected] => 1000 
            [apiPath:protected] => http://hh.api.carltonsoftware.co.uk 
        ) 
        ...
    )
)
4

1 回答 1

2

这不是一个数组,它是一个对象。您可以使用以下语法访问对象变量,尽管不是受保护的变量:

$var->id;
于 2013-09-04T20:10:22.640 回答