这就是我现在正在使用的:
//variable assignment that create strings from text input element
$xmlUsernameStr = $xmlDetail->userString();
//this is the function used above
public function userString(){
return $user;//this is the variable that holds username on input element
}
//assignments in php script
$sxml = new SimpleXmlElement(file_get_contents('details.xml'));
$xmlDetailTag = new SimpleXMLElement('<detail></detail>');
//details.xml contains:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<details>
<detail></detail>
</details>
//create another child 'user' within parent 'detail'
$aUserTag = $sxml->detail->addChild('user');
那么,如果我所拥有的是正确的,那么实际写入 xml 的内容是什么?