guys I’m trying generate XML using php but I’m not able to change response header to xml
\Yii::$app->response->format = \yii\web\Response::FORMAT_XML;
$date = date('Y-m-d');
$homeurl = $_SERVER['HTTP_HOST'] . \Yii::$app->homeUrl;
$sitemap = new \SimpleXMLElement('<urlset/>');
$animelist = Anime::find()->all();
foreach ($animelist as $anm) {
$lurl = $sitemap->addChild('url');
$lurl->addChild('loc',"$homeurl$anm->url/");
$lurl->addChild('changefreq',"daily");
$lurl->addChild('priority',"0.8");
}
print($sitemap->asXML());