mardi 10 juillet 2018

Read file data line by line

I tried the following code :

    $contents = File::get(storage_path('files\In\/'.$filename));
     foreach($contents as $line) {
                        echo $line. "working \n";
    }

Here $contents returning string not array.

Error :

"Invalid argument supplied for foreach()"

when I var_dump data it returns the following result :

string 'A, B, V<B ,B b B a sdasd' (length=31)

Input file attached. enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire