public function exportCSV($title, $info) {
$count = count(explode(',', $title));
$content = $title;
$content = iconv("utf-8", "gb2312", $content) . "\n";
foreach ($info as $key => $value) {
for($i=0; $i<$count; $i++ ){
$content .= '"'.iconv("utf-8", "gb2312", $value[$i]).'",';
}
$content .= "\n";
}
//导出CSV文件
header("Content-Type: text/plain");
header("Content-Disposition: attachment; filename=" . date("Ymdhis") . ".csv;");
header('Pragma: cache');
header('Cache-Control: public, must-revalidate, max-age=0');
echo $content;
exit;
}
$count = count(explode(',', $title));
$content = $title;
$content = iconv("utf-8", "gb2312", $content) . "\n";
foreach ($info as $key => $value) {
for($i=0; $i<$count; $i++ ){
$content .= '"'.iconv("utf-8", "gb2312", $value[$i]).'",';
}
$content .= "\n";
}
//导出CSV文件
header("Content-Type: text/plain");
header("Content-Disposition: attachment; filename=" . date("Ymdhis") . ".csv;");
header('Pragma: cache');
header('Cache-Control: public, must-revalidate, max-age=0');
echo $content;
exit;
}