在我的項目目錄,我已經安裝了作曲家,並設置composer.json像這樣:Zend_Db可能需要加載什麼?
{
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
}
],
"require": {
"zendframework/zend-db": "2.0.*"
}
}
並運行:
$ php composer.phar install
這似乎完成罰款。在我的項目目錄中的文件database.php中,我有:
require_once 'vendor/autoload.php';
// Automatically load class Zend_Db_Adapter_Pdo_Mysql
// and create an instance of it.
$db = Zend_Db::factory('Pdo_Mysql', array(
'host' => "host",
'username' => "username",
'password' => "password",
'dbname' => "dbname"
));
但是當我運行該腳本,我得到:
$ php Database.php
PHP Fatal error: Class 'Zend_Db' not found in /path/project/Database.php on line 4
PHP Stack trace:
PHP 1. {main}() /path/project/Database.php:0
我所缺少的腳本,找到「Zend_Db的'班?
'Zend_Db'是ZendFw 1的一部分,你的作曲家文件需要ZF2模塊,這是一個不同的野獸一起[見的文檔](HTTP:// framework.zend.com/manual/current/en/modules/zend.db.adapter.html) – 2015-03-25 12:09:56