php添加/更新xml内容标记具有=\"&引用\

php添加/更新xml内容标记具有=\"&引用\,php,html,xml,Php,Html,Xml,addxmlcontent.php //加载XML文件 <?php $xml = simplexml_load_file($cat.".xml"); $users = new SimpleXMLElement($xml->asXML()); $count = count($users); $ids = $xml->xpath("//content/id"); // select all ids $cur_id = max(array_m

addxmlcontent.php //加载XML文件

<?php
    $xml = simplexml_load_file($cat.".xml");
    $users = new SimpleXMLElement($xml->asXML());
    $count = count($users);

    $ids = $xml->xpath("//content/id"); // select all ids
    $cur_id = max(array_map("intval", $ids)) + 1; // change objects to `int`, get `max()`, + 1

    $query = $users->addChild("content");
    $query->addChild("id",$cur_id);
    $query->addChild("title",$title);
    $query->addChild("code",$code);
    $query->addChild("postedby",$adminName);
    $query->addChild("image",$lesimg);
    $query->addChild("video",$lesvid);
    $query->addChild("live",$lestry);

    $users->asXML($cat.".xml");

    $xml = simplexml_load_file($cat.".xml");
    $dom = new DOMDocument('1.0');
    $dom->preserveWhiteSpace = false;
    $dom->formatOutput = true;
    $dom->loadXML($xml->asXML());
    $dom->save($cat.".xml");


 header ("location: home.php");
?>
添加类似属性的标记时

<iframe width="560" height="315" src="https://www.youtube.com/embed/5DpGuk_fWGQ?list=PL8XXvQHPisgC7VEA0tSgzXK3uL4bfWaF-" frameborder="0" allowfullscreen></iframe>

xml的输出是

<live>
<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/5DpGuk_fWGQ?list=PL8XXvQHPisgC7VEA0tSgzXK3uL4bfWaF-\" frameborder=\"0\" allowfullscreen></iframe>
</live>

问题是属性为\“\”的标记

注意:使用免费托管网站解决此问题。
注意:使用localhost时,它可以正常工作,而不使用=\“\”


你认为是什么导致了这个问题?

这可能是选项
magic\u quotes\u gpc
的结果。它可能在免费主机站点中打开,而在本地主机中关闭


用于查看该选项是否已启用。如果是,您可以使用从转义字符中筛选数据(如
\“

解决问题的好方法谢谢,我已经通过编辑.htacess php\u value magic\u quotes\u gpc off php\u value magic\u quotes\u runtime off关闭关闭关闭了我网站中的魔法引号
<live>
<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/5DpGuk_fWGQ?list=PL8XXvQHPisgC7VEA0tSgzXK3uL4bfWaF-\" frameborder=\"0\" allowfullscreen></iframe>
</live>