你的xml文件结构是确定的吗?
如果是确定的,直接写出到文本文件即可

可以建立一个模版如
<root>
<author><!author/></author>
<date><!dates/></date>
</root>
读入模版
$filename = "temp.xml";
$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
然后对模版中的内容进行替换即可得到
$contents=str_replace('<!author/>',$_POST['author'],$contents);
$contents=str_replace('<!dates/>',$_POST['dates'],$contents);
最后将该文件输出到文本文件即可。$filename = "output.xml";
$fd = fopen ($filename, "wb");
$fwrite($fd,$contents);
fclose ($fd);