获取值 stdClass 对象 PHP

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11231638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 00:01:46  来源:igfitidea点击:

Get values stdClass Object PHP

phpobject

提问by Suneth Kalhara

I work with mp4 data extract php script. this returns a stdClass Object as below. can anyone tell me how to show the duration from below object. thank you

我使用 mp4 数据提取 php 脚本。这将返回一个 stdClass 对象,如下所示。谁能告诉我如何显示下方对象的持续时间。谢谢你

stdClass Object
(
    [hasVideo] => 1
    [hasAudio] => 1
    [video] => stdClass Object
        (
            [width] => 472
            [height] => 360
            [codec] => 224
            [codecStr] => H.264
        )

    [audio] => stdClass Object
        (
            [codec] => 224
            [codecStr] => AAC
        )

    [duration] => 622.8
)

回答by Blaster

You could do:

你可以这样做:

echo $yourObject->duration;