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)容是
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)用方法:
$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);
}
- CodeIgniter集成smarty的方法詳解
- Codeigniter中集成smarty和adodb的方法
- CodeIgniter中使用Smarty3基本配置
- 讓codeigniter與swfupload整合的最佳解決方案
- Codeigniter整合Tank Auth權限類庫詳解
- CI(CodeIgniter)框架中的增刪改查操作
- CodeIgniter啟用緩存和清除緩存的方法
- Codeigniter(CI)框架分頁函數(shù)及相關知識
- CI(CodeIgniter)框架配置
- CodeIgniter輔助函數(shù)helper詳解
- php之CodeIgniter學習筆記
- CodeIgniter整合Smarty的方法詳解
相關文章
創(chuàng)建數(shù)據(jù)庫php代碼 用PHP寫出自己的BLOG系統(tǒng)
今天的任務是創(chuàng)建數(shù)據(jù)庫,因為對數(shù)據(jù)庫懂的很少,所以在數(shù)據(jù)庫表關系上還很差啊。2010-04-04通過PHP的Wrapper無縫遷移原有項目到新服務的實現(xiàn)方法
這篇文章主要介紹了通過PHP的Wrapper無縫遷移原有項目到新服務的實現(xiàn)方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-04-04PHP+swoole實現(xiàn)簡單多人在線聊天群發(fā)
這篇文章主要介紹了PHP+swoole實現(xiàn)簡單多人在線聊天群發(fā) 的相關資料,需要的朋友可以參考下2016-01-01PHP設計模式之迭代器(Iterator)模式入門與應用詳解
這篇文章主要介紹了PHP設計模式之迭代器(Iterator)模式,結合實例形式詳細分析了PHP迭代器模式的相關概念、原理、應用案例及操作注意事項,需要的朋友可以參考下2019-12-12