我正在执行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] =>
    )

)

下面是我用来获取输出的代码。我只是想知道有没有办法做一个修剪或什么东西提取的网址,所以我可以存储它。
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>";
}
}

最佳答案

你是说

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

关于php - PHRETS GetObject()返回数组,需要提取URL,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40559550/

10-10 15:33