【发布时间】:2015-03-19 03:24:45
【问题描述】:
我收到这个错误
注意:试图在
中获取非对象的属性警告:无效 为 foreach() 提供的参数
$username = strtolower($username); // sanitization
$token = $token;
$url = "https://api.instagram.com/v1/users/search?q=".$username."&access_token=".$token;
echo $url;
$get = @file_get_contents($url, 0);
var_dump($get);
$json = json_decode($get);
//var_dump($json = json_decode($get));
foreach($json->data as $user)
{
if($user->username == $username)
{
return $user->id;
}
}
【问题讨论】:
-
您已经拥有
var_dump。调查 -
在试图找出脚本不起作用的原因时抑制可能的错误/警告并不聪明……删除
@。
标签: php json instagram-api