1

嗨,有人可以告诉我为什么这个 inst 保存到我的 XML 文件中吗?它不返回任何错误但也不写入文件?这可能很愚蠢,所以我提前道歉

<?php

$pastor    = $_POST["Speaker"];
$title     = $_POST["Title"];
$link      = $_POST["podcasturl"];
$download  = $_POST["Download"];
$podcastid = $_POST["Podcastid"];
$pubdate   = $_POST ["Date"];

$filename = 'podcast.xml';

$xml = simplexml_load_file($filename);
$xml->addChild('title');
$xml->addChild('pastor', $pastor);
$xml->addChild('title', $title);

function saveXMLFormatted($xml, $filename) {
    $savexml                     = new DOMDocument('1.0');
    $savexml->preserveWhiteSpace = FALSE;
    $savexml->loadXML($xml->asXML());
    $savexml->formatOutput = TRUE;
    file_put_contents($filename, $savexml->saveXML());
}
4

0 回答 0