在速度与符号@ PHP访问对象属性 [英] PHP Access Object Property with @ at the rate symbol
本文介绍了在速度与符号@ PHP访问对象属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是API与此结构返回一个对象,
An api is return an object with this structure,
[ABC] => stdClass Object
(
[@total] => 149.66667
)
这是导致print_r的功能,如何访问总的价值,我已经试过
This is result in print_r function, how to access total's value, i have tried
ABC->@total
ABC->total
ABC['total']
ABC['@total']
但没有任何工程。
but nothing works.
推荐答案
裹入 {}
:
$ABC->{"@total"}; // here it needs to insert quotes as well
另外请注意,您必须preFIX美元符号类的对象,这是的链接到沙盒的例子。
这篇关于在速度与符号@ PHP访问对象属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文