简体   繁体   English

使用PHP函数从XML获取数据

[英]get data from XML using PHP function

I currently have an XML file(http://redmine.something.com/projects.xml). 我目前有一个XML文件(http://redmine.something.com/projects.xml)。 I want to read that data to insert into my database using PHP function which I don't know how to write the function to get the data. 我想使用PHP函数读取要插入到数据库中的数据,但我不知道如何编写函数以获取数据。 Below is my example of that XML file structure: 下面是我的XML文件结构示例:

<projects type="array" total_count="7" offset="0" limit="25">
    <project>
       <id>147</id>
       <name>012-003: online shop jakob schlaepfer</name>
       <identifier>012-003</identifier>
       <created_on>2012-02-01T09:14:29+07:00</created_on>
       <updated_on>2012-02-20T10:58:28+07:00</updated_on>
    </project>
</projects>

Any link or help would be really appreciated. 任何链接或帮助将不胜感激。 Thanks. 谢谢。

You're looking for SimpleXML . 您正在寻找SimpleXML Here are some basic examples . 这是一些基本的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM