我有XML文件,我嘗試獲得價值。我需要從變量media_id值12345。我怎樣才能得到它與PHP和simplexml?如何使用simplexml獲得價值?
<?xml version="1.0" encoding="UTF-8"?>
<Playerdata>
<Clip>
<MediaType>video_episode</MediaType>
<Duration>5400</Duration>
<PassthroughVariables>
<variable name="media_type" value="video_episode"/>
<variable name="media_id" value="12345"/>
</PassthroughVariables>
</Clip>
</Playerdata>
我現在只有:
$xml = simplexml_load_file("file.xml");