简体   繁体   中英

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 value, 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM