3

我正在执行一个 for 循环来遍历 MLS 列表。我能够获得我需要的每一点信息,但我似乎无法弄清楚如何从我得到的数组中提取 URL。

这是我从 for 循环中得到的数组:

PHRETS\Models\Object Object

(

[content_type:protected] => text/xml
[content_id:protected] => 9577056
[object_id:protected] => 1
[mime_version:protected] => 
[location:protected] => http://cdnparap100.paragonrels.com/ParagonImages/Property/P10/CAT/9577056/0/0/0/42ab28468ab0dfc6fd83dfb39e5dfff7/3/55ec2da6d4a32437d345d0992fae1851/9577056.JPG
[content_description:protected] => 
[content_sub_description:protected] => 
[content:protected] => 


[preferred:protected] => 
[error:protected] => PHRETS\Models\RETSError Object
    (
        [code:protected] => 0
        [message:protected] => 
    )

)

以下是我用来获取该输出的代码。我只是想知道是否有办法进行修剪或提取URL,以便我可以存储它。

for ($i = 0; $i <= count($listID); $i++) {

$photo = $rets->GetObject('Property', 'Photo', $mls, '*', 1);

foreach ($photo as $image) {
    echo "<pre>";
    print_r($image);
    echo "<br>";
    echo "</pre>";
}
}
4

1 回答 1

3

你的意思是喜欢

foreach ($photo as $image) {
    echo 'Location: ', $image->getLocation(), '<br>';
}

?

请参阅https://github.com/troydavisson/PHRETS/blob/master/README.md#downloading-media-photos-images-documents-etc

方法在这里详述~ https://github.com/troydavisson/PHRETS/blob/master/src/Models/Object.php#L109

于 2016-11-15T02:31:00.300 回答