I have a mediawiki and phpbb install that I integrated single sign on with successfully.
问题是,他们都有一个用户类别,例如,在媒体上,当我叫Sphpbb 时,他们就犯了一类红学错误。
I got around this by checking if the file is being loaded by mediawiki. If it is, it called a complete copy of the user class called phpbb_user instead. But I m wondering if there is a better way. This is how it currently works
if (!defined( FROM_MEDIAWIKI )){
class User extends session{
//user class code
}
}else{
class phpbb_user extends session{
//exact copy of user class code
}
}
是否有更好的办法做到这一点,不需要2份用户类别的副本?
我知道你不能这样做,但你能否做这样的事情?
$className = (defined( FROM_MEDIAWIKI ))? phpbb_user : User ;
class $className extends session{
//user class code
}