开发者

How to open, edit child and save to file in simple XML php

This is my code

$data = simplexml_load_file("data.xml");
$data -> mysuname = $_POST["mysqluname"];
$data -> myspwd = $_POST["mysqlpwd"];
$data -> mysdb = $_POST["db_name"];
$data -> saveXml();

But when I open the data.xml I couldn't find these values But echoing $_POST[variable] prints the valu开发者_开发技巧e, so its not null

I figured out that, the problem is with SELinux in fedora, I disabled it and everything is fine.


you should try this :

$data = simplexml_load_file("data.xml");
$data -> mysuname = $_POST["mysqluname"];
$data -> myspwd = $_POST["mysqlpwd"];
$data -> mysdb = $_POST["db_name"];
$data -> asXML("data.xml");

http://www.php.net/manual/en/simplexmlelement.asxml.php

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜