欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

codeigniter集成ucenter1.6雙向通信的解決辦法

 更新時間:2014年06月12日 15:28:37   投稿:shichen2014  
用codeigniter開發(fā)一個子網(wǎng)站,之后想和原來的論壇進行同步,包括同步登陸和雙向通信。這篇文章主要介紹了codeigniter集成ucenter1.6雙向通信的解決辦法,需要的朋友可以參考下

用codeigniter開發(fā)一個子網(wǎng)站,之后想和原來的論壇進行同步,包括同步登陸和雙向通信

先裝好ucenter,然后新建一個other的應用,把生成的代碼拷出來,新建一個config.ini.php到你的uc_client,ucenter會產(chǎn)生一個yourdomain.com/api/uc.php的請求,/api/uc.php不需要填寫,要保證ucenter請求正確位置,才能做到雙向通信

把uc_client復制到你的網(wǎng)站,目錄可以自己定,就根目錄吧。如果你把api目錄放到uc_client目錄低下,那么應用的請求路徑y(tǒng)ourdomain.com/uc_client,如果api也放在根目錄請求地址uc_client可以去掉

建一個libraries/Ucenter.php內(nèi)容是

復制代碼 代碼如下:
<?php
class Ucenter {
    function __construct() {
        require_once FCPATH . './api/uc_client/config.inc.php';
        require_once FCPATH . './api/uc_client/client.php';
    }

    function getUserId() {
        return $this->_uid;
    }

    function getUserName() {
        return ucwords(strtolower($this->_username));
    }

    function login($username, $password) {
        return uc_user_login($username, $password);
    }
    function synlogin($uid) {
        return uc_user_synlogin($uid);
    }

    function login_out() {
        return uc_user_synlogout();
    }

    function regediter($username, $password, $email) {
        return uc_user_register($username, $password, $email);
    }
}
?>

具體要反回哪些函數(shù),可以在上面代碼加上,可以打開uc_client/client.php看,可以加上你需要的函數(shù),返回即可。

調(diào)用方法:

復制代碼 代碼如下:
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->library('ucenter');
list($uid, $username, $password, $email) = $this->ucenter->login($username, $password);
if(!empty($uid)){
    //生成同步登錄的代碼
    $ucsynlogin = $this->ucenter->synlogin($uid);
}

相關文章

最新評論