我正在尝试从JSON请求中获取数据。我目前正在使用此代码:
<?php
$url='http://localhost:8080/rest/api/2/user?username=username';
$jiraUsers = file_get_contents($url);
$testUsers = json_decode($jiraUsers);
echo $testUsers[0];
我没有得到任何错误,但是得到了警告,没有别的:
我想念什么?还是file_get_contents
不是首先获取数据的正确方法,我必须使用类似cURL
的东西(更复杂吗?)?