XMLファイルから広告をロードするJwプレーヤーアドトノミープラグインを使用して、自分のWebサイトで使用するカスタムプラグインを作成しています。ただし、ファイル内のノードを更新する方法がわかりません。単純な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>
*/
}
?>