Php “错误”;类别';Zend#u Config#u Writer#u Xml';“未找到”;何时将Zend库集成到CodeIgniter中?

Php “错误”;类别';Zend#u Config#u Writer#u Xml';“未找到”;何时将Zend库集成到CodeIgniter中?,php,codeigniter,zend-framework,Php,Codeigniter,Zend Framework,我复制了一些Zend库并将它们粘贴到CodeIgniter的libraries文件夹中。我尝试使用这个代码,没关系: $this->zend->load('zend/json'); $data = array( 'name' => 'Killer Whale', 'email' => 'namnguyen2091@gmail.com', 'website' => 'baogiadientu.com' ); // load and enco

我复制了一些Zend库并将它们粘贴到CodeIgniter的libraries文件夹中。我尝试使用这个代码,没关系:

$this->zend->load('zend/json');

$data = array(
    'name' => 'Killer Whale',
    'email' => 'namnguyen2091@gmail.com',
    'website' => 'baogiadientu.com'
);

// load and encode data
$json = new Zend_Json();
$encode = $json->encode($data);
echo $encode;

//decode with static function
echo '<pre>';
print_r(Zend_Json::decode($encode));
echo '</pre>';

我关注这篇文章。请帮帮我

您正在尝试做两件事(1)加载并实例化Zend Config对象,以及(2)使用Zend_Config_Writer_Xml执行相同的操作-所有操作都不包括所需的文件


在确保它们位于include_路径中之后,您可能只需要require(“Zend/Config.php”)和require(“Zend/Config/Writer/Xml.php”)就可以了,因为您正在使用ZF1库和ZF2文档

请在其网站上查看正确的文档:


但是我是通过这个代码加载的$this->zend->load('zend/config')$config=new Zend_config(array(),true)?然后,Zend代码似乎不在您的include路径中,将其作为一个参考,您应该能够使事情正常工作。
$this->zend->load('zend/config');

// create the config object
$config = new Zend_Config(array(), true);
$config->production = array();

$config->production->webhost = 'baogiadientu.com';
$config->production->database = array();
$config->production->database->params = array();
$config->production->database->params->host = 'localhost';
$config->production->database->params->username = 'root';
$config->production->database->params->password = '123456';
$config->production->database->params->dbname = 'baogiadientu';

$writer = new Zend_Config_Writer_Xml(); // **here**
echo $writer->toString($config);