07-24-2009, 06:51 PM
|
#2 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Ok, a few points.
- The line with fopen() is doing absolutely nothing useful in that script. It is the call to the file() function that brings in the file, fopen isn't needed.
- To use file_get_contents to grab a file just use
$content = file_get_contents($filename); along with that third line. That will do what the code snippet you showed does.
- You're wanting to parse CSV data please don't try and do it manually: PHP has a built-in function called fgetcsv or it is super-easy to use SplFileObject::fgetcsv (see the 2nd example in particular).
|
|
|
|