Problems trying to list csv

0

Hello,

I'm trying to read csv files from a folder via script.

via browser it shows me the correct values of the array, however via CLI it presents me with an empty array. Follow the code

$files = glob('*.csv');
var_dump($files);

Output via browser:

array(2) { [0]=> string(22) "Perdas\Score_Gauss.csv" [1]=> string(16) "Perdas\teste.csv" }

Output via CLI:

array(0){}

Any idea why this might be happening?

    
asked by anonymous 20.02.2018 / 15:32

1 answer

1

The code is correct, I would do it in a different way but the code would be too large. Is the server you are running on your machine? Perhaps part of the directory path (PATH) is missing, one level above probably does not exist CSV files and so lists 0 arrays.

For example, on the server the file path may vary:

/htdocs/www/

On your machine it can be:

C:\xampp\www
    
20.02.2018 / 18:24