fgetcsv unreadable code
Posted: Wed Jun 02, 2010 8:51 pm
Hi guys.
I use fgetcsv like php manual
however it doesn't work correctly.
I can only get some unreadable code from the following function
what is more ,I also try setlocale(LC_ALL,'zh_CN'); in my script and nothing happened
my csv file is empty .
any help will be appreciated
I use fgetcsv like php manual
however it doesn't work correctly.
I can only get some unreadable code from the following function
what is more ,I also try setlocale(LC_ALL,'zh_CN'); in my script and nothing happened
my csv file is empty .
Code: Select all
function get_csv_contents( $file_target ){
$handle = fopen( $file_target, 'r');
$contents = fgetcsv($handle, 10, ",");
$coding = mb_detect_encoding($contents[0]);
echo $coding;
print_r($contents);
echo $contents[0];
fclose($handle);
}
$contents = get_csv_contents('test.csv');