开发者

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

开发者 https://www.devze.com 2023-03-12 04:38 出处:网络
This is my code $data = simplexml_load_file(\"data.xml\"); $data -> mysuname = $_POST[\"mysqluname\"];

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

精彩评论

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