I works in my project by LARAVEL.
I want to make sitemap. This is my controller:
class SitemapController extends BaseController {
public function index() {
header("Content-Type: text/xml;charset=utf-8");
return View::make('sitemap');
}
}
And This is my view sitemap.blade.php:
{{<?xml version="1.0" encoding="UTF-8" ?>}}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>{{url()}}</loc>
<priority>0.5</priority>
</url>
.
.
.
</urlset>
But result not appeared as XML. It appeared as a normal text.
It works when I used:
{{'<?xml version="1.0" encoding="UTF-8" ?>'}}
and I updated my controller as:
class SitemapController extends BaseController {
public function index() {
$content = View::make('sitemap');
return Response::make($content)->header('Content-Type', 'text/xml;charset=utf-8');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With