[英]how to read and update the config file in zend framework
當我嘗試更新配置文件時,拋出異常
“無法寫入文件”/opt/lampp/htdocs/fashion/application/configs/d.xml“
$xml=ROOT_PATH.'/application/configs/d.xml';
$config=new Zend_Config_Xml($xml,null,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>';
}
xml文件
<?xml version="1.0" encoding="UTF-8"?>
<data>
<name>ahmed</name>
<living>Saudi Arabia</living>
</data>
當我將它保存到另一個文件時,它可以工作,但它似乎被鎖定如何解鎖
我認為你的“d.xml”不是Apache可寫的!
您的“configs”目錄肯定是可寫的(這適用於新文件),但不是您的默認文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.