科哈纳的斯特托克
我无法理解以下几行的含义。我想在 Kohana 中配置现有项目。我在文档中搜索过,但确实很难找到。我不知道它是在哪个版本中开发的,我正在kohana-3.2中配置它。
$devName = strtok($_SERVER['HTTP_HOST'], '.');
$devName = strtok('.');
$devName = 'production';
$zcf = new Zend_Config_Ini(APPPATH . 'config/website.ini');
Zend_Registry::set('config', $zcf->$devName);
$db = Zend_Db::factory($zcf->$devName->db);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
提前致谢。
I'm not able to understand meaning of following lines. I want to configure an existing project in Kohana. I searched in documentation but it's really hard to find. I don't know which in version it was developed, I'm configuring it in kohana-3.2.
$devName = strtok($_SERVER['HTTP_HOST'], '.');
$devName = strtok('.');
$devName = 'production';
$zcf = new Zend_Config_Ini(APPPATH . 'config/website.ini');
Zend_Registry::set('config', $zcf->$devName);
$db = Zend_Db::factory($zcf->$devName->db);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要了解项目中使用的 Kohana 版本,您可以:
Request::factory()
方法在请求流程中随时调用另一个请求。尝试运行Request::factory()
。如果找到类和方法 - 您使用 Koahana 3 分支,如果没有找到 - Koahana 2 分支。Kohana::config()
但 Kohana 3.2 使用Kohana::$config->load()
。我所记得的一切:)
To get know the version of Kohana used in project you can:
Request::factory()
method to call another request at any time during the request flow. Try to runRequest::factory()
. If class and method are found - you use Koahana 3 branch, if they not - Koahana 2 branch.Kohana::config(<config_file_name>)
but Kohana 3.2 usesKohana::$config->load(<config_file_name>)
.All I can remember :)