将Zend libary集成到CodeIgniter时出错“类'Zend_Config_Writer_Xml'?

I copy some Zend libraries and paste them into libraries folder in CodeIgniter. I try to use this code, it's ok:

$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>';

But when I code like below, it doesn't work and I get an error: Fatal error: Class 'Zend_Config_Writer_Xml' not found in D:\Programs\xampp\htdocs\baogiadientu\application\controllers\product.php on line 83

$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);

I follow this article http://framework.zend.com/manual/2.0/en/modules/zend.config.writer.html. Please help me!

You are trying to do two things there (1) load and instantiate a Zend Config object and (2) do the same with Zend_Config_Writer_Xml - all without including the required files.

You may just need to require("Zend/Config.php") and require("Zend/Config/Writer/Xml.php") after ensuring they are inside your include_path

You are using a ZF1 library with the ZF2 documentation

Please check the correct documentation at their website:

http://framework.zend.com/manual/1.12/en/zend.config.writer.introduction.html