function output_csv($myfile,$q_id){
setlocale(LC_ALL, "zh_TW.BIG5");//設定編碼為BIG5
$dir="questionary/files/";//此為小弟預設的資料夾
$source=$dir.$myfile;
if(!$fp=fopen($source,"r")){
echo "ERROR";
exit;
}else{
$size=filesize($source)+1;
$row=0;
while($temp=fgetcsv($fp,$size,",")){
if($row>0){
$str=$str.$temp[1].",";
}else if($row==$size-1){
$str=$str.$temp[1];
}
$row=$row+1;
}
fclose($fp);
}
}
資料來源:http://lamb-mei.blogspot.com/2007/11/phpcsvmysql.html