{
"require" : {
"facebook/php-sdk-v4" : "~5.0"
},
"autoload": {
"psr-4": {
"MyApp\": "lib/"
}
}
}
{
"require": {
"abraham/twitteroauth": "^0.6.2"
}
}
conposer.jsonでこのように指示し
libの中にFacebookLogin.phpを作っているのですが、
No such class: FacebookLoginと帰ってきます。
どうすればいいでしょうか?
ドットインストールのフェイスブックログインの通りにしています。
ちなみにindex.phpは
<?php require_once(__DIR__ . '/config.php'); require_once(__DIR__ . '/config2.php'); $fbLogin = new MyApp\FacebookLogin(); $twitterLogin = new MyApp\TwitterLogin(); if ($twitterLogin->isLoggedIn()) { $me = $_SESSION['me']; $twitter = new MyApp\Twitter($me->tw_access_token, $me->tw_access_token_secret); $tweets = $twitter->getTweets(); MyApp\Token2::create(); } if ($fbLogin->isLoggedIn()) { $me = $_SESSION['me']; $fb = new MyApp\Facebook($me->fb_access_token); $userNode = $fb->getUserNode(); $posts = $fb->getPosts(); MyApp\Token::create(); } ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>Twitter Connect!</title> <style> #container { width: 500px; margin: 0 auto; } h1 { font-size: 18px; border-bottom: 1px solid #ccc; padding: 3px 0; } #login { text-align: center; margin: 70px auto; } #logout { float: right; } </style> </head> <body> <div id="container"> <h2>My Timeline</h2> <?php if ($fbLogin->isLoggedIn()) : ?><?php else : ?><div id="logout"> <form action="logout.php" method="post"> <input type="submit" value="Log out"> <input type="hidden" name="token" value="<?= h($_SESSION['token']); ?>"> </form> </div> <div id="profile"> <img src="http://graph.facebook.com/<?= h($me->fb_user_id); ?>/picture" class="pic"> <h1><a href="<?= h($me->fb_link); ?>"><?= h($me->fb_name); ?></a></h1> <p><?= h($userNode['email']); ?></p> </div> <ul> <?php foreach ($posts as $post) : ?> <li><?= h($post['message']); ?></li> <?php endforeach; ?> </ul>
<?php endif; ?> <?php if ($twitterLogin->isLoggedIn()) : ?><div id="login"> <a href="login.php" class="btn">Facebook Login</a> </div>
<?php else : ?><form action="logout2.php" method="post" id="logout"> <input type="submit" value="Log Out"> <input type="hidden" name="token" value="<?= h($_SESSION['token']); ?>"> </form> <h1>@<?= h($me->tw_screen_name); ?>'s Timeline</h1> <ul> <?php foreach ($tweets as $tweet) : ?> <li><?= $tweet->text; ?></li> <?php endforeach; ?> </ul>
<?php endif; ?> </div> </body> </html><h1>My Timeline</h1> <div id="login"> <a href="login2.php"><img src="signin_button.png"></a> </div>
こうなっています。
よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー