程式碼如下:
/*
*/
if(!function_exists('l')) { echo '
***********************************
';
}
}
if(file_exists('test10_12.xml')) {
$xml = simplexml_load_file('test10_12.xml');
//利用xpath方法找出節點位置$
title[@name="t1"]/ancestor::item');
var_dump($query);
l();
//測試在title節點下新增子節點new
$query[0] ->title->addChild('new','new');
//測試在title節點下新增屬性fuck
$query[0]->title->addAttribute('fuck','fuck you' );
//測試修改content節點值為hello,world
$query[0]->content = 'hello,world';
//不解釋,你懂的
$query[0]->asXML ("10.xml");
}
?>