开发者

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

开发者 https://www.devze.com 2023-02-17 20:27 出处:网络
I am new to XML, please help. I have a small xml file like this... <?xml version=\"1.0\" encoding=\"utf-8\"?>

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

精彩评论

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