我刚刚开始与facebook的php sdk混在一起,但无济于事。尽管php对我ubuntu
实例上的所有其他内容工作正常,但facebook的php sdk并没有(即php代码没有被执行)。所有依赖项(仅curl
和json
)已启用并正常工作。
我试图调查/var/log/apache2/error.log
,但似乎文件是空的 - 但也许我没有找到正确的位置。
所以我的问题是:调试此问题的步骤是什么!谢谢你帮助一个菜鸟!
这是来自facebook的样板index.php代码:
<?php
require '../src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxx',
));
// Get User ID
$user = $facebook->getUser();
// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$statusUrl = $facebook->getLoginStatusUrl();
$loginUrl = $facebook->getLoginUrl();
}
// This call will always work since we are fetching public data.
$naitik = $facebook->api('/naitik');
?>