本文介绍了尝试在PHP中以文字'$'开头打印stdClass对象的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的对象名称是$ distinct1
My object name is $distinct1
print_r($ distinct1)
显示下面的对象,但是当我尝试时
print_r($distinct1)
shows the object below but when I try to do
echo $distinct1->properties->city
OR
echo $distinct1->distinct_id
我没有得到任何价值回报。知道发生了什么吗?
I don't get any value return. Any idea whats going on?
stdClass Object
(
[$distinct_id] => AAA
[$properties] => stdClass Object
(
[$city] => Palo Alto
[$country_code] => US
[$region] => California
[$name] => John Smith
)
)
推荐答案
Hm,如果您的属性的确如此命名:
Hm, if your properties are really named like that:
$distinct1->{'$properties'}->{'$city'}
但如果可能,我会d研究设置&em;的机制。在那里修复它。
But if possible, I'd look into the mechanism that sets it like that & fix it there.
这篇关于尝试在PHP中以文字'$'开头打印stdClass对象的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!