所以我發現在Facebook上登錄集成教程:http://www.excellencemagentoblog.com/facebook-login-integration-website
Facebook的登錄不定義功能
我跟着它一步一步和谷歌鉻合金開發工具給我一個錯誤點擊Facebook Login
說後:
Uncaught TypeError: object is not a function index.php:53 onclick
按鈕HTML是這樣的:
<a class="btn btn-success" href='#' onclick='login();'>
<i class="icon-facebook"></i>
Facebook Login
</a>
該腳本如下s,我真的不知道什麼是錯的,因爲這個函數是在腳本中定義的。
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : ' 163289720517425', // App ID
channelURL : '', // Channel File, not required so leave empty
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : false // parse XFBML
});
};
// logs the user in the application and facebook
function login(){
FB.getLoginStatus(function(r){
if(r.status === 'connected'){
window.location.href = 'php/fbconnect.php';
}else{
FB.login(function(response) {
if(response.authResponse) {
//if (response.perms)
window.location.href = 'php/fbconnect.php';
} else {
// user is not logged in
}
},{scope:'email'}); // which data to access from user profile
}
});
}
// Load the SDK Asynchronously
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
您是否安裝了PHP SDK? – KyleK