In the laravel controller if someone wants to just send html as response and show it in the browser what is the best way to perform this action without any issue.
I want something like:
$html = "<html>-- All html document content --</html>"
// to show as html in browser.
return $html;
After some search I found a simple way, you can give any another way to perform this operation or if this is wrong way to do.
return response($html, 200)->header('Content-Type', 'text/html');
It worked on my machine. Kindly do give more suggestions
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