日期:2014-05-17 浏览次数:20659 次
$dom = new DOMDocument("1.0","utf-8");
header("Content-Type: text/html; charset=unicode");
//items
$root = $dom->createElement("items");
$dom->appendChild($root);
//count
$count = $dom->createAttribute("count");
$root->appendChild($count);
$count_value = $dom->createTextNode("6");
$count->appendChild($count_value);
//item
$item = $dom->createElement("item");
$root->appendChild($item);
$text = $dom->createTextNode($content);
$item->appendChild($text);
//id
$id = $dom->createAttribute("id");
$item->appendChild($id);
$idValue = $dom->createTextNode("156");
$id->appendChild($idValue);
//title
$title = $dom->createAttribute("title");
$item->appendChild($title);
$titleValue = $dom->createTextNode("test");
$title->appendChild($titleValue);
$content=$dom->saveXML();