2014-03-13 69 views
0

我正在開發一個具有社交功能和數據庫驅動應用程序的移動應用程序。我正在用PHP,mysql完成註冊和登錄系統。但我想發佈系統,並希望在配置文件部分顯示用戶信息以及想要創建更新用戶名或密碼?所有這些員工都不可能在PHP中(我錯了)。那麼,有什麼替代方法可以做到這一點(我聽說傑森,但沒有適當的員工如何顯示數據)。有人可以向我解釋如何顯示用戶數據並顯示我的帖子,如Facebook發佈。關於rmote數據庫的intel xdk移動應用程序

回答

0

您可以使用英特爾XDK JavaScript API登錄併發布到Facebook。下面是一些示例代碼,並進行了深入的教程鏈接可以在這裏找到:https://software.intel.com/en-us/html5/articles/integrating-facebook-functionality-into-hybrid-apps-using-the-intel-xdk

//要登錄到Facebook的

alert("about to log into facebook"); 
document.addEventListener("intel.xdk.facebook.login",function(e){ 
    if (e.success == true) 
    { console.log("Facebook Log in Successful"); } 
    else 
    { console.log("Unsuccessful Login"); } 
},false); 
intel.xdk.facebook.login("publish_stream,publish_actions,offline_access");  

//要註銷Facebook的

alert("logging out of facebook"); 
document.addEventListener("intel.xdk.facebook.logout",function(e){ 
    if (e.success == true) 
    { console.log("Logged out of Facebook"); } 
    else 
    { console.log("Unsuccessful Logout"); } 
},false); 
intel.xdk.facebook.logout(); 

//使用Graph API從Facebook獲取數據

var facebookUserID = "me"; //me = the user currently logged into Facebook 
document.addEventListener("intel.xdk.facebook.request.response",function(e) { 
    console.log("Facebook User Friends Data Returned"); 
    if (e.success == true) { 
      var data = e.data.data; 
      var outHTML = ""; 

      for (var r=0; r< data.length; r++) { 
      outHTML += "<img src='http://graph.facebook.com/" 
         + data[r]["id"] 
         + "/picture' info='" 
         + data[r]["name"] + "' />"; 
      } 
      document.getElementsByTagName("body")[0].innerHTML = outHTML; 
      document.removeEventListener("intel.xdk.facebook.request.response"); 
    } 
},false); 
intel.xdk.facebook.requestWithGraphAPI(facebookUserID  
+ "/friends","GET","");        

//將用戶狀態過帳到費用d來自Facebook使用圖表API

var facebookUserID = "me"; //me = the user currently logged into Facebook 
document.addEventListener("intel.xdk.facebook.request.response",function(e) { 

    if (e.success == true) { 
      console.log("Facebook Message posted"); 
      document.removeEventListener("intel.xdk.facebook.request.response"); 
    } 
},false); 
intel.xdk.facebook.requestWithGraphAPI(facebookUserID + "/{user-id}/feed","POST", 
             "message={" + message + 
             "}&access_token={" + access-token + "}");