Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Zend framework 当我的数据库适配器为空时,Zend Framework如何工作?_Zend Framework - Fatal编程技术网

Zend framework 当我的数据库适配器为空时,Zend Framework如何工作?

Zend framework 当我的数据库适配器为空时,Zend Framework如何工作?,zend-framework,Zend Framework,因此,我在这里查看此文档页面: 我对它进行了测试,结果是这样一行:$this->\u getParam('db')转储为null。所以我想问是否有人可以向我解释Zend Framework的行为。如果db适配器为空,那么脚本的其余部分如何工作?它是否自动转到application.ini以获取db适配器信息?另外,$this->\u getParam('db')应该从何处获取参数“db”?这取决于如何实例化db适配器并使用它 如果在应用程序/configs/application.ini中使用类

因此,我在这里查看此文档页面:


我对它进行了测试,结果是这样一行:
$this->\u getParam('db')转储为
null
。所以我想问是否有人可以向我解释Zend Framework的行为。如果db适配器为空,那么脚本的其余部分如何工作?它是否自动转到application.ini以获取db适配器信息?另外,
$this->\u getParam('db')
应该从何处获取参数“db”?

这取决于如何实例化db适配器并使用它

如果在
应用程序/configs/application.ini
中使用类似以下内容:

resources.db.adapter          = "pdo_mysql"
resources.db.params.host      = "localhost"
resources.db.params.username  = "myuser"
resources.db.params.password  = "mypass"
resources.db.params.dbname    = "mydatabase"

然后(默认情况下)将此适配器设置为
Zend_Db_表
及其子类(可能包括您的一些型号)使用的默认适配器。

。很高兴这有帮助。干杯