Php/xml/SimpleXMLElement
提供: 初心者エンジニアの簡易メモ
配列からxml生成
$xmlstr = "<?xml version='1.0' encoding='utf-8'?><tags></tags>"; $xml = new SimpleXMLElement($xmlstr); $tags = [ 'name' => 'taro', 'age' => 1 ]; foreach($tags as $key => $value) { $xml->addChild($key, $value); } echo $xml->asXML();