下列错误显示为下面给出的代码PROPERT:试图让非对象错误
未定义的属性:stdClass的:: $持续时间在C:\ WAMP \ WWW \ TEMP \ yy.php
试图让非对象的属性在C:\ WAMP \ WWW \ TEMP \ yy.php
如何解决?
$q = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=$a,$b&destinations=$c,$d&mode=driving&sensor=false";
$json = file_get_contents($q);
$details = json_decode($json);
$d=$details->rows[0]->elements[0]->duration->text;
做的'$ json'一个'var_dump',以确保它是有效的JSON。此外,执行'$ details'的'var_dump'来确保它是一个对象。 –
你有什么在这些('起源= $ a,$ b&destinations = $ c,$ d')变量? –