编程语言
首页 > 编程语言> > 我如何从该数组(stdClass)php获取数据?

我如何从该数组(stdClass)php获取数据?

作者:互联网

我如何从该数组(stdClass)php获取数据?

Array
(
    [0] => stdClass Object
        (
            [id] => 4
            [programs] => FireFox
            [version] => 4.00
            [type] => Browsers
            [description] => fdmkfdsf,sdfdsfdsfdsf
dfdsf
sd
f
dsf
ds
f
            [views] => 2
            [serial] => 434343-343434-3434-c
        )

)

当我尝试使用foreach获取它时,出现了该错误

#
A PHP Error was encountered

Severity: 4096

Message: Object of class stdClass could not be converted to string

Filename: views/results.php

Line Number: 2

我如何获取程序(例如FireFox)的数据?

解决方法:

$data = (your data);

echo $data[0]->programs;

标签:stdclass,fetch,arrays,php
来源: https://codeday.me/bug/20191208/2092357.html