0

我有以下 XML 树:

<?xml version="1.0" encoding="utf-8"?>

<root>
    <start_info>
            <info tabindex="1">
            <infonumber>1</infonumber>
            <trees>green</trees>
            </info>
    </start_info>
    <people>
        <pe>
            <people_ages>
                <range number="1">
                    <age value="1">1</age>
                    <age value="2">2</age>
                </range>
            </people_ages>
        </pe>
    </people>
</root>

首先,我必须在复选框中显示所有节点,然后必须在提交文件时检索它们的节点值。我必须使用 PHP 来完成。

4

1 回答 1

1

You can either you use

1) $movies = new SimpleXMLElement($xmlstr);

echo $movies->movie[0]->plot;
OR
echo $movies->movie->{'great-lines'}->line;    

2) good way and easy to use XML into Array,http://www.bin-co.com/php/scripts/xml2array/ this website gives you lib to convert XML to array.

于 2012-09-19T16:59:19.630 回答