0
我有一個TextArea
調用myTextArea
我想將xml寫入它而不是文件。我怎樣才能做到這一點?將xml文件寫入TextArea而不是文件
我當前的代碼:
$doc->formatOutput = true;
$r = $doc->createElement("employees");
$doc->appendChild($r);
foreach($employees as $employee)
{
$b = $doc->createElement("employee");
$name = $doc->createElement("name");
$name->appendChild(
$doc->createTextNode($employee['name'])
);
$b->appendChild($name);
$age = $doc->createElement("age");
$age->appendChild(
$doc->createTextNode($employee['age'])
);
$b->appendChild($age);
$salary = $doc->createElement("salary");
$salary->appendChild(
$doc->createTextNode($employee['salary'])
);
$b->appendChild($salary);
$r->appendChild($b);
}
echo $doc->saveXML();
$doc->save("write.xml");
?>
<Form name="fName">
<TextArea name="myTextArea"></TextArea>
</Form>
非常感謝你這個工作。 – MethodManX