【发布时间】:2015-11-23 06:05:09
【问题描述】:
我正在尝试从这里获取内容:
http://t.c4tw.net/MatchUser?hash_key=563b755ac53a3&json=1
$json = file_get_contents('http://t.c4tw.net/MatchUser?hash_key=563b755ac53a3&json=1');
$obj = json_decode($json);
var_dump($json);
结果
string(0) ""
file_get_contents 与其他链接一起工作正常,有没有办法用 php 获取这些数据?
【问题讨论】:
-
您必须检查提供给
file_get_contents()的路径是否返回有效数据或不为空。 -
它正在返回 {"twuser_id":"NzE5MTY1NTYwMTg2NjQ5ODI5OA.."}
-
是的,我用的是
&json=1,所以根据api,数据应该是json。 -
似乎
file_get_contents没有返回任何内容,因为您正在打印它的返回值。你有任何错误吗?可能类似于:stackoverflow.com/questions/19024349/…。我们需要更多信息。 -
var_dump($obj);返回NULL