/ Published in: PHP

CSV(unicode) file to php array
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
sample.csv ---------------- name,email 政府,[email protected] 한êµ,[email protected] ---------------- ======================================= <?php function str_to_csv( $row ) { if( $row=='' ) { } do{ { } $match = null; ]*$/', $p, $match )) { $p = $match[1]; } return $a; } function file_getcsv( $f ) { while( ($a = str_to_csv($line))===false ) { } return $a; } function file_to_csv( $filename ) { { $rec = file_getcsv($f); if( $rec===false ){ return false; } { $a[] = $rec; } } return $a; } $data = file_to_csv('sample.csv');
Comments
