色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

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);
}

php技術codeigniter集成ucenter1.6雙向通信的解決辦法,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 太保市| 西城区| 花莲市| 合川市| 县级市| 葵青区| 宁晋县| 北京市| 屯门区| 信宜市| 酒泉市| 安西县| 永春县| 金山区| 新乡市| 芷江| 阜康市| 桂林市| 定远县| 古蔺县| 中超| 泰安市| 九龙县| 依兰县| 鄢陵县| 韶山市| 运城市| 北安市| 城步| 龙门县| 塔河县| 华阴市| 香港| 寿宁县| 桐城市| 台中县| 萍乡市| 原阳县| 宜君县| 龙江县| 潜山县|