错误在php中下载和解析json时尝试获取非对象的属性

时间:2017-03-28 15:23:19

标签: php arrays json curl

我正在尝试打印字段名称:实体名称并收到错误说"尝试获取非对象的属性"

$accrdNo = '3001044';

$url = "http://localhost:8080/webservice/index.php?id=$accrdNo";

$client = curl_init($url);

curl_setopt($client, CURLOPT_URL, $url);
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($client, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($client);

$encoded = json_encode($result, true);
$decoded = json_decode($encoded, true);

echo $decoded->{'va_entity_name'};

0 个答案:

没有答案