[英]Accessing a property of an object in php
I am trying to access the property of a certain object, but its now working. 我正在尝试访问某个对象的属性,但是它现在可以正常工作。 This is the full result.
这是完整的结果。
So how can i access the lat property in the location object? 那么,如何访问location对象中的lat属性? For some reason its not working
由于某种原因,它不起作用
SimpleXMLElement Object
(
[status] => OK
[result] => SimpleXMLElement Object
(
[type] => postal_code
[formatted_address] => Workington, Workington, Cumbria CA14 3QP, UK
[address_component] => Array
(
[0] => SimpleXMLElement Object
(
[long_name] => CA14 3QP
[short_name] => CA14 3QP
[type] => postal_code
)
)
[geometry] => SimpleXMLElement Object
(
[location] => SimpleXMLElement Object
(
[lat] => 54.6352139
[lng] => -3.5516768
)
[location_type] => APPROXIMATE
)
)
)
i am trying to get the lat property, but its not working 我正在尝试获取lat属性,但无法正常工作
this is what im using 这就是即时通讯
echo $result->result->geometry->location["lat"];
Result should be 结果应该是
echo $result->result->geometry->location->lat;
Not 不
echo $result->result->geometry->location["lat"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.