gpt4 book ai didi

php - 将 PHP 数组转换为 XML?

转载 作者:行者123 更新时间:2023-12-04 19:38:24 25 4
gpt4 key购买 nike

假设我有一个这样的数组:

<?php
$colors=array();

$colors[0]['id']=1;
$colors[0]['color']='blue';


$colors[1]['id']=2;
$colors[1]['color']='green';

......
?>

将整个数组转换为 XML 的最简单方法是什么?

最佳答案

Some working Example for the Data in Question that is on-site: https://stackoverflow.com/a/14143759/367456

Original answer follows:

看看这些预定义的实现:

http://snipplr.com/view/3491/convert-php-array-to-xml-or-simple-xml-object-if-you-wish/

http://vantulder.net/f2o/notities/arraytoxml/

关于php - 将 PHP 数组转换为 XML?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1209604/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com