Fatal error: Call to a member function toArray() on a non-object in C:\AppServ\www\zend3\index.php
搞zf框架配置数据库时报错!config.ini:[general]db.adapter=PDO_MYSQLdb.params.host=localhostdb.para...
搞zf框架 配置数据库时 报错!config.ini :[general]
db.adapter=PDO_MYSQL
db.params.host = localhost
db.params.username = root
db.params.password = 123456
db.params.dbname = message
index.php
//配置数据库参数,并连接数据库
$config=new Zend_Config_Ini('./application/config/config.ini',null, true);
Zend_Registry::set('config',$config);
$dbAdapter=Zend_Db::factory($config->general->db->adapter,$config->general->db->config->toArray());
$dbAdapter->query('SET NAMES UTF8');
Zend_Db_Table::setDefaultAdapter($dbAdapter);
Zend_Registry::set('dbAdapter',$dbAdapter);
求高手解决 如需要 补充信息 请留言 展开
db.adapter=PDO_MYSQL
db.params.host = localhost
db.params.username = root
db.params.password = 123456
db.params.dbname = message
index.php
//配置数据库参数,并连接数据库
$config=new Zend_Config_Ini('./application/config/config.ini',null, true);
Zend_Registry::set('config',$config);
$dbAdapter=Zend_Db::factory($config->general->db->adapter,$config->general->db->config->toArray());
$dbAdapter->query('SET NAMES UTF8');
Zend_Db_Table::setDefaultAdapter($dbAdapter);
Zend_Registry::set('dbAdapter',$dbAdapter);
求高手解决 如需要 补充信息 请留言 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询