无法解析时,我想开始我的项目插件 “multidb”
问题描述:
我有如下因素的错误消息:无法解析时,我想开始我的项目插件 “multidb”
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Unable to resolve plugin "multidb"; no corresponding plugin with that name' in C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php:330
Stack trace:
#0 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(314): Zend_Application_Bootstrap_BootstrapAbstract->getPluginResource('multidb')
#1 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(673): Zend_Application_Bootstrap_BootstrapAbstract->hasPluginResource('multidb')
#2 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('multidb')
#3 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(579): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('multidb')
#4 C:\xampp\htdocs\modular_zf\application\Bootstrap.php(41): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('multidb')
#5 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract in C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php on line 330
bootstrap.php中(从第39行)
protected function _initDatabases()
{
$this->bootstrap('multidb'); // line 41
$resource = $this->getPluginResource('multidb');
$databases = Zend_Registry::get('config')->resources->multidb;
foreach ($databases as $name => $adapter)
{
$db_adapter = $resource->getDb($name);
Zend_Registry::set($name, $db_adapter);
}
}
应用.ini
[bootstrap]
...
...
;Database settings
resources.multidb.front_db.adapter = "pdo_mysql"
resources.multidb.front_db.host = 127.0.0.1
resources.multidb.front_db.username = admin
resources.multidb.front_db.password = admin
resources.multidb.front_db.dbname = modular_zfdb
resources.multidb.front_db.default = true
...
...
我有同样的消息('无法解析插件...)在其他类似项目中激动不已
谢谢。
答
更换线41 & 42本
$resource = $this->bootstrap('multidb')->getResource('multidb');
+0
谢谢,多数民众赞成在罚款。这也是一个ZF版本的问题 – Salem 2012-03-26 13:27:33
您正在使用什么版本的Zend框架的? – dbrumann 2012-03-25 19:55:39
正在使用ZF v1.11.4,我应该使用最新版本吗? – Salem 2012-03-25 20:13:44
建议升级到更新版本,但可能不是问题的根源。尝试使用'$ this-> hasPluginResource('multidb')'而不是'$ this-> bootstrap('multidb')'检查插件资源。 – dbrumann 2012-03-25 20:46:31