$content = new DomDocument();
$content->load('shuxue.xml');
$playlist = $content->documentElement;
$tracklist1 = $playlist->documentElement;
// $tracklist = $content->createElement('tracklist');
// $playlist->appendChild($tracklist);
$track = $content->createElement('track');
$tracklist1->appendChild($track);
$title = $content->createElement('title');
$title->appendChild($content->createTextNode($_POST['title']));
$track->appendChild($title);
$song_id = $content->createElement('song_id');
$song_id->appendChild($content->createTextNode($_POST['title']));
$track->appendChild($song_id);
$fp = fopen("shuxue.xml","w");
$info = $content->savexml();
if(fwrite($fp,$info))
echo "success";
else
echo "fail";
$content->load('shuxue.xml');
$playlist = $content->documentElement;
$tracklist1 = $playlist->documentElement;
// $tracklist = $content->createElement('tracklist');
// $playlist->appendChild($tracklist);
$track = $content->createElement('track');
$tracklist1->appendChild($track);
$title = $content->createElement('title');
$title->appendChild($content->createTextNode($_POST['title']));
$track->appendChild($title);
$song_id = $content->createElement('song_id');
$song_id->appendChild($content->createTextNode($_POST['title']));
$track->appendChild($song_id);
$fp = fopen("shuxue.xml","w");
$info = $content->savexml();
if(fwrite($fp,$info))
echo "success";
else
echo "fail";
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货