开发者

how to read and update the config file in zend framework

when i tried to update the configuration file an exception is thrown

"Could not write to file "/opt/lampp/htdocs/fashion/application/configs/d.xml"

$xml=ROOT_PATH.'/application/configs/d.xml';
$config=new Zend_Config_Xml($xml,n开发者_StackOverflowull,true);
$conf_arr=$config->toArray();
$conf_arr['name']='somebody';
$conf_writer=new Zend_Config_Writer_Xml();
try 
{
  $conf_writer->write($xml,new Zend_Config($conf_arr),false);
} catch (Exception $e) 
{
  echo '<h1 style="color:red;">'.$e->getMessage().'</h1>';
}

the xml file

<?xml version="1.0" encoding="UTF-8"?>
<data>
    <name>ahmed</name>
    <living>Saudi Arabia</living>
</data>

when i save it to another file it works but it seems to be locked how to unlock


I think your your "d.xml" is not writable by Apache !?

Your "configs" directory is certainly writable (this work with new file), but not your default file .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜