当我运行此代码时,它会运行一段时间,而其他时候它不会运行并给出此异常 例外:1:发生未知错误
这是代码
$user_access_token= $rowsUser['access_token'];
$user= $rowsUser['userId'];
$email= $rowsUser['email'];
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
'cookie' => true,
));
$access_token=$facebook->setAccessToken($user_access_token);
try{
$fql = 'SELECT relationship_status,website,contact_email,work,education,
current_location,uid, name,birthday_date,sex,email, profile_url
FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user.')';
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$_friends = $facebook->api($param);
print_r($_friends);
}catch(Exception $ex){
echo $ex;
}
非常感谢任何帮助。
答案 0 :(得分:1)
这是一个非常常见的错误..
$_friends = $facebook->api('/'.$param);
使用此代码解决您的问题。 Facebook有时会在不使用正斜杠的情况下返回数据,但有时会抛出错误。它在PHP / SDK中的错误..