traineratwot/xmltodict
最新稳定版本:1.1.1
Composer 安装命令:
composer require traineratwot/xmltodict
包简介
xml parser LIKE python xmltodict
关键字:
README 文档
README
A complete analogue of XmlToDict for python, but written in PHP
Полный аналог XmlToDict для python, но написанный на PHP
install
composer require traineratwot/xmltodict
Usage
$array = XmlToDict::load(__DIR__ . '/test.xml'); $xml = file_get_contents(__DIR__ . '/test.xml') $array = XmlToDict::parse($xml);
example
<?xml version="1.0" encoding="UTF-8"?> <books> <book id="1"> <title meta="test">Harry Potter and the Philosopher's Stone</title> <author>J.K. Rowling</author> <publisher>Bloomsbury</publisher> <year>1997</year> </book> <book id="2"> <title meta="test2">The Lord of the Rings</title> <author>J.R.R. Tolkien</author> <publisher>George Allen & Unwin</publisher> <year>1954</year> </book> <item>Text</item> <item2 desc="Lorem">Text</item2> <item3></item3> </books>
{
"books": {
"book": [
{
"@id": "1",
"title": {
"@meta": "test",
"#text": "Harry Potter and the Philosopher's Stone"
},
"author": "J.K. Rowling",
"publisher": "Bloomsbury",
"year": "1997"
},
{
"@id": "2",
"title": {
"@meta": "test2",
"#text": "The Lord of the Rings"
},
"author": "J.R.R. Tolkien",
"publisher": "George Allen & Unwin",
"year": "1954"
}
],
"item": "Text",
"item2": {
"@desc": "Lorem",
"#text": "Text"
},
"item3": null
}
}
supported
php 7.3+
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2023-05-20