# yii-ucenter **Repository Path**: mirrors/yii-ucenter ## Basic Information - **Project Name**: yii-ucenter - **Description**: No description available - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/yii-ucenter - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2017-04-02 - **Last Updated**: 2026-01-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README yii-UCenter ======= 基于UCenter的Yii扩展
重中之重:修改uc的配置文件ucenter/api/config.inc.bak.php名字为config.inc.php,并修改为正确的配置信息。
1、在配置文件中引用yii-ucenter:
'import'=>array('ext.ucenter.interface.UC_IUser',
'ext.ucenter.class.*',
'ext.ucenter.UCenter',
),2、用你的用户模型实现UC_IUser接口:
class User extends Model implements UC_IUser
{
……
public function getUserName(){
return $this->username;
}
/**
* 取得uid
* @return int
*/
public function getUid(){
return $this->uid;
}
}
……
3、继承UC_WebUser,并创建用户模型实例给ucUser:
class WebUser extends UC_WebUser
{
public function init(){
$this->ucUser=new User();
parent::init();
}
}
4、继承UC_UserIdentity,并创建用户模型实例给_user:
class UserIdentity extends UC_UserIdentity
{
public function __construct($username,$password){
parent::__construct($username,$password);
$this->_user=new User();
}
}