如何修复 Facebook 致命错误:未捕获的 CurlException 问题 [英] how to fix a facebook Fatal error: Uncaught CurlException problem
问题描述
我不时从 facebook 收到此错误:
I've got this error coming from facebook, from time to time:
致命错误:未捕获的 CurlException:28:connect() 超时!在第 614 行的/var/www/html/xxx/facebook/src/facebook.php 中抛出
它破坏了我的网站.
这是来自 facebook.php 的代码
this is the code from facebook.php
if ($result === false) {
$e = new FacebookApiException(array(
'error_code' => curl_errno($ch),
'error' => array(
'message' => curl_error($ch),
'type' => 'CurlException',
),
));
curl_close($ch);
throw $e;
}
有没有办法解决这个问题?或至少优雅地降级?谢谢
is there a way to fix this? or at lease to degrade gracefully ? thanks
我正在考虑 arr a return false;
如果 $result === true
但不知道能不能解决
i am thinking to arr a return false;
if the $result === true
but i don't know if that will fix it
推荐答案
捕获异常以避免立即致命错误杀死,但您仍然需要适应 facebook 数据不可用.请参阅 http://www.php.net/catch
Catch the exception to avoid the immediate Fatal Error kill, but you still need to adjust to facebook data not being available. See http://www.php.net/catch
try {
// facebook code
} catch (Exception $e) {
// maybe something more graceful...
echo 'Caught exception: ', $e->getMessage(), "\n";
}
// regular execution continues.
这篇关于如何修复 Facebook 致命错误:未捕获的 CurlException 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!