开发者

Select and echo a random entry from an XML file in php

I am new to XML, please help. I have a small xml file like this...

<?xml version="1.0" encoding="utf-8"?>
<VISITOR> 
    <VID="1">
        <NAME>Irena Lyns</NAME>
        <FROM>Shenfield</FROM>
        <COMMENT>I'm so glad I came.Everything is so beautiful.</COMMENT>
    </VID> 
    <VID="2">
        <NAME>Gabriella</NAME>
        <FROM>ITALIA</FROM>
        <COMMENT>Wonderful!!! </COMMENT>
    </VID>
<开发者_如何学JAVA/VISITOR>

What is the code I would need to display a random VID, NAME, FROM and COMMENT on my php page?

Thank you in advance!!! :)


parse it with SimpleXML and chose random record from result - look at examples

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜