PHP新手。。。。我正在尝试访问一个数组中的值,该值来自一个解码的json文件。我将我的变量打印到屏幕上,然后返回。。。
Array (
[0] => stdClass Object (
[period] => 0
[title] => Sunday
[fcttext] => Mostly cloudy with a chance of ...
[pop] => 50 )
[1] => stdClass Object (
[period] => 1
[title] => Sunday Night
[fcttext] => Partly cloudy. Low of 64F. Win....
[pop] => 10 )
[2] => stdClass Object (
[period] => 2
[title] => Monday
[fcttext] => Partly cloudy. High of 90F. Winds less than 5 mph.
[pop] => 10 )
[3] => stdClass Object (
[period] => 3
...
)
)
例如,如何访问周期1中的fcttext?
谢谢!
使用->
运算符访问类方法和属性:
echo $arr[1]->fcttext;
查看参考-这个符号在PHP中是什么意思?当您不确定php中运算符的含义时。