Home  >  Article  >  Backend Development  >  php zend_db使用解决方案

php zend_db使用解决方案

WBOY
WBOYOriginal
2016-06-13 11:48:50724browse

php zend_db使用
php zend_db的使用Zend_Registry::set('db', $db)后,Zend_Registry::get('db')不到,报没set的错误


$db = Zend_Db::factory($config->database->adapter, $config->database->config->toArray());

Zend_Registry::set('db', $db);

//Zend_Db_Table::setDefaultAdapter($db);

header("Location: application/views/aa.htm");

?>

aa.html初期化时要调用一个php.

$this->_db = Zend_Registry::get('db');这时就报错。

是不是必须在zf框架下才可以使用zend的东西,不使用框架,直接引用zend不可以吗?

谢谢。
------解决方案--------------------
是不是必须在zf框架下才可以使用zend的东西,不使用框架,直接引用zend不可以吗?
是的,其原理就是重新使用oop定义了zend函数,方法。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn