将对象数组转换为xml

时间:2017-07-18 00:20:54

标签: php xml

我是新来的,我希望有人可以帮助我...... 我有一个阵列,看起来像这样。我需要在文档中包含它,其中包含所有对象。 问题是,Array与Objects混合在一起。 数组应如下所示:

<markers>
  <marker e10="1.279" e5="1.299" diesel="1.089" place="Illertissen" postCode="89257" houseNumber="19" adress="Saumweg" lng="10.10018" lat="48.23068" name="V-Markt Illertissen"/>
<marker e10="1.259" e5="1.279" diesel="1.069" place="Senden" postCode="89250" houseNumber="50" adress="Ulmer Str." lng="10.03625" lat="48.32817" name="Tankstelle Möbel Inhofer"/>  

$Umkreissuchedec =json_decode($Umkreissuche);
stdClass Object
(
    [ok] => 1

    [license] => CC BY 4.0 -  https://creativecommons.tankerkoenig.de
    [data] => MTS-K
    [status] => ok
    [stations] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 8dcb0636-a988-4e1a-aef1-9369e95fa644
                    [name] => Markenfreie TS EISENACH
                    [brand] => Markenfreie TS
                    [street] => KASSELER STR.
                    [place] => EISENACH
                    [lat] => 50.977776
                    [lng] => 10.304671
                    [dist] => 3.5
                    [diesel] => 1.209
                    [e5] => 1.429
                    [e10] => 1.409
                    [isOpen] => 
                    [houseNumber] => 9
                    [postCode] => 99817
                )

            [1] => stdClass Object
                (
                    [id] => e1a15081-2611-9107-e040-0b0a3dfe563c
                    [name] => Eisenach, Kasseler Str. 55
                    [brand] => HEM
                    [street] => Kasseler Str.
                    [place] => Eisenach
                    [lat] => 50.981205
                    [lng] => 10.301261
                    [dist] => 3.8
                    [diesel] => 1.149
                    [e5] => 1.369
                    [e10] => 1.349
                    [isOpen] => 
                    [houseNumber] => 55
                    [postCode] => 99817
                )

0 个答案:

没有答案