如何访问此变量

时间:2017-07-21 11:00:27

标签: php arrays

嗨大家:)我有类似的东西:

Array
(
    [0] => Ideneal\OpenLoad\Entity\RemoteUploadStatus Object
        (
            [remoteUpload:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => Ideneal\OpenLoad\Entity\RemoteUpload Object
                (
                    [id:Ideneal\OpenLoad\Entity\RemoteUpload:private] => xxxx
                    [folderId:Ideneal\OpenLoad\Entity\RemoteUpload:private] => xxxx
                )

            [remoteUrl:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => https://openload.co/embed/xxxxx
            [status:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => finished
            [bytesLoaded:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => 
            [bytesTotal:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => 
            [addedDate:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => DateTime Object
                (
                    [date] => 2017-07-21 10:53:55.000000
                    [timezone_type] => 3
                    [timezone] => Europe/Berlin
                )

            [lastUpdateDate:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => DateTime Object
                (
                    [date] => 2017-07-21 10:53:55.000000
                    [timezone_type] => 3
                    [timezone] => Europe/Berlin
                )

            [fileId:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => xxxx
            [url:Ideneal\OpenLoad\Entity\RemoteUploadStatus:private] => https://openload.co/f/xxxx <------------ Here is what I want to write to a variable
        )

)

(代码末尾是评论) 怎么做?

我试过类似的东西:print_r($ myarray [0] [url:Ideneal \ OpenLoad \ Entity \ RemoteUploadStatus:private]) 什么都没有。

1 个答案:

答案 0 :(得分:0)

尝试使用RemoteUploadStatus对象方法:

$myarray[0]->getUrl();

参考:https://github.com/Ideneal/OpenLoad/blob/master/src/Entity/RemoteUploadStatus.php