注意:未定义的属性:stdClass::$error位于C:\xampp\htdocs\liker2\dashboard.php的第131行
我犯了这个错误,有人能在一段时间前解决吗?没有错误,但今天我在我的页面上犯了这个错误注意:未定义的属性:stdClass::$error位于C:\xampp\htdocs\liker2\dashboard.php的第131行,php,json,Php,Json,我犯了这个错误,有人能在一段时间前解决吗?没有错误,但今天我在我的页面上犯了这个错误 if(isset($_GET['type'])){ if($_GET['type'] == "status"){ $beranda = json_decode(get_html("https://graph.facebook.com/$user->id/statuses?fields=id,message&limit=7&access_token=$token"))->dat
if(isset($_GET['type'])){
if($_GET['type'] == "status"){
$beranda = json_decode(get_html("https://graph.facebook.com/$user->id/statuses?fields=id,message&limit=7&access_token=$token"))->data;
foreach($beranda as $id){
$status = 'isset';
$status .= '
<section class="status">
<section class="image">
<img style="-webkit-border-top-left-radius: 37px;
-moz-border-radius-topleft: 37px;
border-top-left-radius: 37px;
-webkit-border-top-right-radius: 0px;
-moz-border-radius-topright: 0px;
border-top-right-radius: 0px;
-webkit-border-bottom-right-radius: 37px;
-moz-border-radius-bottomright: 37px;
border-bottom-right-radius: 37px;
-webkit-border-bottom-left-radius: 0px;
-moz-border-radius-bottomleft: 0px;
border-bottom-left-radius: 0px;"src="https://graph.facebook.com/'.$user->id.'/picture">
</section>
<section class="name">'.$user->name.'</section>
<section class="message"><span class="color">'.$id->message.'</span></section> //// on line 131 /////
<form action="" method="post">
<input type="hidden" name="id" value="'.$id->id.'">
<input type="submit" name="submit" value="Submit" class="submit"></form>
</section>';
}
}
if(isset($\u GET['type'])){
如果($_GET['type']==“status”){
$beranda=json_解码(获取html(“https://graph.facebook.com/$user->id/status?字段=id,消息和限制=7&access_token=$token”)->数据;
foreach($beranda作为$id){
$status='isset';
$status.='
id./图片“>
“.$user->name。”
“.$id->消息。”////在第131行/////
';
}
}
很明显,返回的JSON可能并不总是包含error
属性,因此您应该在使用它之前检查它是否存在,如下所示:
if (isset($user->error)) {
...
}
我认为您的
$token
无效。添加var\u dump($beranda)的输出
请到邮局。我还有更多错误,你能查一下吗this@RiyazSaifi错误是什么?未定义的属性:stdClass::$message我可以向您发送我的liker.php吗file@RiyazSaifi但是,您的代码中甚至没有任何消息属性!您还需要提供有关该问题的一些信息,编辑您的问题帖子,我会回答您的问题看:)