codeigniter集成ucenter1.6双向通信的解决办法
框架(架构)  /  管理员 发布于 8年前   169
用codeigniter开发一个子网站,之后想和原来的论坛进行同步,包括同步登陆和双向通信 先装好ucenter,然后新建一个other的应用,把生成的代码拷出来,新建一个config.ini.php到你的uc_client,ucenter会产生一个yourdomain.com/api/uc.php的请求,/api/uc.php不需要填写,要保证ucenter请求正确位置,才能做到双向通信 把uc_client复制到你的网站,目录可以自己定,就根目录吧。如果你把api目录放到uc_client目录低下,那么应用的请求路径yourdomain.com/uc_client,如果api也放在根目录请求地址uc_client可以去掉 建一个libraries/Ucenter.php内容是 function getUserId() { function getUserName() { function login($username, $password) { function login_out() { function regediter($username, $password, $email) { 具体要反回哪些函数,可以在上面代码加上,可以打开uc_client/client.php看,可以加上你需要的函数,返回即可。 调用方法:
function __construct() {
require_once FCPATH . './api/uc_client/config.inc.php';
require_once FCPATH . './api/uc_client/client.php';
}
return $this->_uid;
}
return ucwords(strtolower($this->_username));
}
return uc_user_login($username, $password);
}
function synlogin($uid) {
return uc_user_synlogin($uid);
}
return uc_user_synlogout();
}
return uc_user_register($username, $password, $email);
}
}
?>
$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);
}您可能感兴趣的文章:
test1 在
opencode + Oh-my-openagent,我的第一个免费的ai编程智能体管家:Sisyphus中评论 test..122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..Zita 在
Google AI Studio升级全栈 vibe coding体验,可直接构建带登录和数据库的应用中评论 111222..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号
