gpt4 book ai didi

php - ZEND 框架 fatal error : Uncaught exception 'Zend_Application_Bootstrap_Exception'

转载 作者:行者123 更新时间:2023-11-30 00:51:14 26 4
gpt4 key购买 nike

我搜索了很多,但没有得到任何解决方案。我收到以下错误并在此之后卡住了。

Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception'with message 'Resource matching "db" not found' in/var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php:694Stack trace: #0/var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(629):Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('db')

1 /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586):

Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('db') #2/var/www/html/ZendTecAdmin/application/Bootstrap.php(6):Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('db') #3/var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669):Bootstrap->_initMyDb() #4/var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622):Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('mydb')

5 /var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586):

Z in/var/www/html/ZendTecAdmin/library/Zend/Application/Bootstrap/BootstrapAbstract.phpon line 694

应用程序.ini

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 1

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.baseUrl = "/ZendTecAdmin/"
urces.db.isDefaultTableAdapter = true

resources.db.params.profiler.enabled = true
resources.session.remember_me_seconds = 864000

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

resources.db.adapter = "PDO_MYSQL"
resources.db.parurces.db.isDefaultTableAdapter = true

resources.db.params.profiler.enabled = trueams.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "root123"
resources.db.params.dbname = "appointment_db"
resources.db.isDefaultTableAdapter = true

resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug

公共(public)/index.php

<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run


$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
Zend_Db_Table::getDefaultAdapter();
//define('BASE_URL', $baseUrl);

Bootstrap.php

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initMyDb() {
$this->bootstrap('db');
$resource = $this->getPluginResource('db');
$db = $resource->getDbAdapter();
$db->query('SET CHARACTER SET \'UTF8\'');
}
}

请帮我解决这个问题。任何支持都将是值得赞赏的。

最佳答案

我在我的项目中使用了这个

protected function _initRegistry()
{
$this->bootstrap('db');
$db = $this->getResource('db');
$db->query("SET NAMES 'utf8'");
}

参见https://code.google.com/p/bhaa/source/browse/trunk/application/Bootstrap.php

关于php - ZEND 框架 fatal error : Uncaught exception 'Zend_Application_Bootstrap_Exception' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20950425/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com