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!