我正在嘗試使用SimpleXML將表單數據(通過_POST)寫入文檔。這是我嘗試過的,我似乎無法讓它工作。獲取表單數據並將其寫入XML文件
<?php
$title = $_POST['title'];
$link = $_POST['link'];
$description = $_POST['description'];
$rss = new SimpleXMLElement($xmlstr);
$rss->loadfile("feed.xml");
$item = $rss->channel->addChild('item');
$item->addChild('title', $title);
$item->addChild('link', $link);
$item->addChild('description', $description);
echo $rss->asXML();
header("Location: /success.html");
exit;
?>
任何幫助或點在正確的方向將不勝感激。
Yo你不能'回聲'的東西,然後使用'header()'。 – Shikiryu
總是發佈運行代碼時發生的錯誤。 –