0
我正在關注Guzzle的文檔,並在json響應中卡住了。這是我的代碼未定義的偏移量:在json響應var_dump()期間Guzzle中的0
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->get('http://httpbin.org/get');
$json = $response->json();
var_dump($json[0]['origin']);
當我運行這個文件,我得到的錯誤
Notice: Undefined offset: 0 in C:\xampp\htdocs\guzzle\config.php on line 8
NULL
爲什麼會出現不確定的偏移?
當你執行'var_dump($ json)'時返回什麼? – Aiias 2015-04-05 02:23:04