vendredi 25 décembre 2015

read file contents in Laravel

I am reading a file into my view(test.blade.php)

<?php
        try
        {
        $contents = File::get(storage_path().'/app/'."test.php");
            echo $contents;
        }
        catch (Illuminate\Filesystem\FileNotFoundException $exception)
        {
        die("The file doesn't exist");
        }

    ?>

but I do not get any output rather output is commented (image) and can be seen by inspect element.
This my test.php file

<?php
$name = "john";
echo "My name is $name";

I am expecting My name is john in my view.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire