How to generate XML file dynamically using PHP?

前端 未结 7 2269
失恋的感觉
失恋的感觉 2020-11-22 00:32

I have to generate a xml file dynamically at runtime. Please help me in generating the below XML file dynamically using PHP.



        
相关标签:
7条回答
  • 2020-11-22 00:51

    With FluidXML you can generate your XML very easly.

    $tracks = fluidxml('xml');
    
    $tracks->times(8, function ($i) {
        $this->add([
            'track' => [
                'path'  => "song{$i}.mp3",
                'title' => "Track {$i} - Track Title"
            ]
        ]);
    
    });
    

    https://github.com/servo-php/fluidxml

    0 讨论(0)
提交回复
热议问题