3
我有一個對象名稱obj
這樣的:PHP讀取對象屬性
stdClass Object
(
[@attributes] => stdClass Object
(
[CurrencyCode] => AUD
[CurrencyName] => AUST.DOLLAR
[Buy] => 17825.4
[Transfer] => 17933
[Sell] => 18092.95
)
)
我使用的一些方法:
obj[CurrencyCode]
obj ->CurrencyCode
但不工作,得到錯誤:Use of undefined constant CurrencyCode
如果使用: obj -> @attributes
得到錯誤:syntax error, unexpected ''@attributes'' (T_CONSTANT_ENCAPSED_STRING)