Merge XML files in PHP

后端 未结 3 1843
半阙折子戏
半阙折子戏 2020-12-01 12:40

I have 2 files 1.xml and 2.xml both having similar structure and I would like to have one. I tried many solutions but I had errors only - frankly s

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 13:08

    How about :

     tags
    preg_replace('//','',$xmlfilecontent);
    
    // remove  tags
    $xmlfilecontent = str_replace('','',$xmlfilecontent );
    
    // remove  tags
    $xmlfilecontent = str_replace('','',$xmlfilecontent );
    
    // remove  tags
    $xmlfilecontent = str_replace('','',$xmlfilecontent );
    
    // load XML Object - also add res and items + amount
    $xmlobj = simple_xml_load_string(''.PHP_EOL.''.PHP_EOL.''.PHP_EOL.$xmlfilecontent.PHP_EOL.''.PHP_EOL.'');
    

提交回复
热议问题