Php 如何从xml文件中检索日期
这是我的xml文件,我不知道如何使用php从xml文件中检索值,如何从xml文件中检索信息。如果您知道,请帮助我Php 如何从xml文件中检索日期,php,xml,wikipedia-api,Php,Xml,Wikipedia Api,这是我的xml文件,我不知道如何使用php从xml文件中检索值,如何从xml文件中检索信息。如果您知道,请帮助我 my xml file: see:http://en.wikipedia.org/w/api.php? format=xml&action=query&titles=vikram&prop=revisions&rvprop=content <api> <query> <normalized>
my xml file:
see:http://en.wikipedia.org/w/api.php? format=xml&action=query&titles=vikram&prop=revisions&rvprop=content
<api>
<query>
<normalized>
<n from="vikram" to="Vikram"/>
</normalized>
<pages>
<page pageid="1034501" ns="0" title="Vikram">
<revisions>
<rev xml:space="preserve">
'''Vikram''' may refer to: *[[Vikram (name)]], a male name in the Hindu
community *[[Vikramāditya]], a legendary king of India **Vikram, a character
in ''[[Baital Pachisi]]'', identified with Vikramāditya **[[Vikram Samvat]]
(Vikram's Era, "V.S." or "B.S"), a popularly used calendar in India and the
official calendar of Nepal, established by Vikramaditya *[[Vikram Pandit]],
CitiGroup CEO *[[Vikram (actor)]], Vikram Kennedy, a Tamil-language Indian
film actor *[[Vikram Sarabhai]], an Indian scientist *[[Vikram
(film)|''Vikram'' (film)]], a 1986 Tamil-language Indian film *[[Vikram (1986
Telugu film)|''Vikram'' (1986 Telugu film)]], a 1986 Telugu-language Indian
film *[[Vikram Seth]], a bestselling author of Indian origin ;See also: *
{{lookfrom|Vikram}} *{{intitle|Vikram}} {{disambig}}
</rev>
</revisions>
</page>
</pages>
</query>
</api>
您可以使用PHP的本机或您可以使用xml_parse_into_struct函数来轻松解析xml
<?php
$simple = "<para><note>simple note</note></para>";
$p = xml_parser_create();
xml_parse_into_struct($p, $simple, $vals, $index);
xml_parser_free($p);
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
?>
您可以使用大量的PHP XML API。试试看。我不明白。请给我样本代码。我链接的页面上有样本代码。我们不是来给你填鸭式地输入代码的。@user1308746:这不是一个让人们为你编写代码的网站。请查看benedict_w提供给您的资源,并亲自尝试。然后,如果你对你的尝试有疑问和问题。让我们知道