내 application.ini 파일에 다음이 있습니다.젠드 프레임 워크 ZFDebug, db 어댑터를 얻는 방법
resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "localhost"
resources.db.params.username = ".."
resources.db.params.username = ".."
resources.db.params.dbname = "lsc3_base"
resources.db.params.dbname = "lsc3_base"
resources.db.isDefaultTableAdapter = true
이제 완벽하게 작동하며 데이터베이스를 쿼리 할 수 있습니다.
임 메인 부트 스트랩 .php 파일에서 다음을 사용하여 쉽게 ZFDebug를 설치하려고합니다.
`protected function _initZFDebug() { $ autoloader = Zend_Loader_Autoloader :: getInstance(); $ autoloader-> registerNamespace ('ZFDebug');
$options = array(
'plugins' => array('Variables',
'Time',
#'Auth',
'Memory',
'Registry',
'Database' => array('adapter' => $db),
'File' => array('basePath' => '/path/to/project'),
#'Cache' => array('backend' => $cache->getBackend()),
'Exception')
);
$debug = new ZFDebug_Controller_Plugin_Debug($options);
$this->bootstrap('frontController');
$frontController = $this->getResource('frontController');
$frontController->registerPlugin($debug);
}
` 이제 분명히 $ db undefined라는 말을 듣게됩니다.
질문은 어떻게 $ db를 잡을 수 있습니까?
다음을 시도 : $ db = Zend_Db_Table :: getDefaultAdapter(); $ db = $ this-> getPluginResource ('db');
내 부팅 스트랩에있는 모든 작업을 수행 한 후 데이터베이스 연결로 인해 작동하지 않는다고 가정합니다. 이 문제를 어떻게 해결할 수 있습니까?