我写了一个脚本,它从 Mysql 数据库中导出一个包含信息的 CSV 文件。该脚本在 Linux Server(Apache) 下运行没有问题,但在 Windows Server(Apache) 下无法运行。
我认为问题出在这个标题上!!!
header('Content-Type: text/x-csv');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename=iBlock_download.csv');
header('Pragma: no-cache');
header("Content-Type: text/html; charset=UTF-8");
这里有人可以帮忙吗?
谢谢
脚本在这里:
header('Content-Type: text/x-csv');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename=iBlock_download.csv');
header('Pragma: no-cache');
header("Content-Type: text/html; charset=UTF-8");
include('./lib/sqlString.php');
$_id=$_GET['_id'];
$ResultPointer = mysql_query("SELECT * FROM projekte where pro_id='$_id'");
for($i = 0, $Export = ""; $i < mysql_num_rows($ResultPointer); $i++)
{
$Daten = mysql_fetch_object($ResultPointer);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_id);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_desc);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_exp);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_animal_nr);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_organ);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_treatment);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_comment);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_genotype);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_start_date);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_aktion);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_txt1);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_aktion);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_user_name);
$ResultPointer2 = mysql_query("SELECT * FROM pro where fn_pro_id ='$Daten->pro_id'");
$sume=mysql_num_rows($ResultPointer2);
for($i = 0, $Export = ""; $i < mysql_num_rows($ResultPointer2); $i++)
{
$sume=mysql_num_rows($ResultPointer2);
$Daten2 = mysql_fetch_object($ResultPointer2);
$Spalte[] = str_replace("\"", "\"\"", $Daten2->fn_desc);
$Spalte[] = str_replace("\"", "\"\"", $Daten2->fn_order_date);
}
for($j = 0; $j < count($Spalte); $j++)
{
$Export .= "\"" . $Spalte[$j] . "\"";
if($j != count($Spalte)-1)
{
$Export .= ";";
}
}
$Export .= "\r\n";
$Spalte = "";
}
echo $Export;