2
我正在使用Jw player adtonomy插件从XML文件加载广告,在我的网站上使用自定义插件。但是我不知道如何更新文件中的节点。我曾尝试使用简单的XML,但我不知道如何更新。任何实施都受到高度重视。谢谢。这是xml文件。如何编辑xml节点值
<xml>
<plugins>adtimage</plugins>
<adtimage.graphic>http://mysite/default.png</adtimage.graphic>
<adtimage.link>http://targetsite.com</adtimage.link>
<adtimage.positions>pre,post</adtimage.positions>
<adtimage.onpause>true</adtimage.onpause>
<adtimage.txt>Advertisement</adtimage.txt>
<adtimage.btntxt>Click to continue with video</adtimage.btntxt>
</xml>
我的代码在这里。
<?php
$xml = simplexml_load_file("test.xml");
echo $xml->getName() . "<br />";
foreach($xml->children() as $child)
{
echo $child->getName() . ": " . $child . "<br />";
/*
TO DO
change the node value of
<adtimage.graphic>http://mysite/default.png</adtimage.graphic>
to
<adtimage.graphic>http://stackoverflow.com</adtimage.graphic>
*/
}
?>
感谢。它工作的时间很长。 – sammyukavi 2012-08-02 10:10:54
欢迎您 – Baba 2012-08-02 10:40:00