Kohana 3.2-phpBB库-使用抽象方法
我正试图在Kohana中实现一个phpBB库 我已在模块中创建了一个供应商文件夹,并按如下方式加载库并对其进行初始化:Kohana 3.2-phpBB库-使用抽象方法,php,include,kohana,kohana-3,abstract,Php,Include,Kohana,Kohana 3,Abstract,我正试图在Kohana中实现一个phpBB库 我已在模块中创建了一个供应商文件夹,并按如下方式加载库并对其进行初始化: require_once Kohana::find_file('vendor/phpbb_library', 'phpbb_library'); $phpbb = new Phpbb_library(); 但是,一旦库开始尝试包含phpBB文件: // Include needed files include($phpbb_root_path . 'common.' . $p
require_once Kohana::find_file('vendor/phpbb_library', 'phpbb_library');
$phpbb = new Phpbb_library();
但是,一旦库开始尝试包含phpBB文件:
// Include needed files
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'config.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
然后,我收到以下错误:
ErrorException [ Fatal Error ]: Class user contains 5 abstract methods and must therefore be declared abstract or implement the remaining methods (Kohana_Session::_read, Kohana_Session::_regenerate, Kohana_Session::_write, ...)
现在包含的文件是phpBB使用的文件,所以显然我不能仅仅修改它们
已于2012年2月1日解决 按照作者提出的解决方案,我创建了自己的Kohana会话类版本,并将它们保存在一个模块中。我必须复制、重命名和编辑的文件有:
/system/classes/session.php
/system/classes/session/cookie.php
/system/classes/session/exception.php
/system/classes/session/native.php
/system/classes/kohana/session.php
/system/classes/kohana/session/cookie.php
/system/classes/kohana/session/exception.php
/system/classes/kohana/session/native.php
在所有文件中,主要编辑包括将类名Session
更改为MySiteSession
和Kohana\u Session
更改为Kohana\u MySite\u Session
。虽然在/system/classes/kohana
文件中有一些变量的用法,但也需要更改名称
现在要使用会话,我只需调用MySiteSession::instance()
PHPBB现在作为include工作,因为我不再使用Session类 CI具有不同的类命名。所有CI类都以
CI\uu
开头,而Kohana不使用任何前缀*
我能想到的唯一解决方案是重构Kohana会话类(在任何地方重命名)或使用phpBB库。但两者都不理想
*)只是想澄清一下,Kohana确实使用了
Kohana\uuu
,但它们的所有类都是由不带前缀的类扩展的。触发错误是因为phpBB和Kohana都有一个会话类。这个问题没有解决办法,怎么可能没有解决办法呢?CodeIgniter允许它工作:我认为Kohana是CodeIgniter框架的一个偏移。您在桥接器实现上真的成功了吗?你能分享一下消息来源吗?Thanks@zdmytriv是的,我按照Michal M的建议做了,并设置了自己的类来处理会话,我现在使用它来代替默认的会话类。这消除了两个系统之间的冲突。我创建了一个新的会话类,并在整个站点中使用它。系统中有一个位置也使用system/classes/kohana/security
文件中的Session::instance()。我不知道我是否应该改变。将尝试扩展它。确认这是有效的,并在原始问题中添加了完整的解释。