I am a novice and I work in PHP. And I do not know anything about xml. My English is not very good. If you see a typo, please edit it
Please see the code below
<?php header("Content-type: text/xml"); $array = ["a", "b", "c"]; echo $array[0];
There is a problem with the output and I can not use the echo. The photo below is my output
please guide me
Advertisement
Answer
I found out from the url that you want to create a sitemap. You should see the output inside a xml
code. for example:
<?php header("Content-type: text/xml"); $array = ["a", "b", "c"]; echo "<?xml version='1.0' encoding='UTF-8'?>"."n"; echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>"."n"; echo "<url>"; echo "<loc>".$array[0]."</loc>"; echo "<lastmod>".$array[1]."</lastmod>"; echo "<changefreq>daily</changefreq>"; echo "</url>"; echo "</urlset>";