config.xml
<?xml version="1.0" encoding="UTF-8"?>
<prize>
<gift>
<giftId>1</giftId>
<giftName>抱枕+防尘塞</giftName>
<probability>0.001</probability>
<number>50</number>
<isGoods>0</isGoods>
</gift>
<gift>
<giftId>2</giftId>
<giftName>笔记本儿+卡套儿+杯垫儿</giftName>
<probability>0.001</probability>
<number>50</number>
<isGoods>0</isGoods>
</gift>
</prize>
index.php
$dom = new DOMDocument('1.0', 'utf-8');
$xml = simplexml_load_file('config.xml');
$length = count($xml->gift);
for($i=0; $i<$length; $i++){
$giftId = $xml->gift[$i]->giftId;
$giftName = $xml->gift[$i]->giftName;
$probability = $xml->gift[$i]->probability;
$number = $xml->gift[$i]->number;
$isGoods = $xml->gift[$i]->isGoods;}
}