how to render a view and save the content in a file in Laravel how to render a view and save the content in a file in Laravel laravel laravel

how to render a view and save the content in a file in Laravel


To get and save your html you just have to:

function getIndex(){    $fs = new Filesystem();    $data = array();    $fs->put("exercise.xml", View::make('xml', $data));}


I found the problem, on top of the template file was a line that said

<?php header('Content-type: text/xml'); ?>

That caused the script to output to the browser, without asking for it. The template was written by someone else so I didn't know about it, but surely I should have checked it before asking