我有用于生成xsl文件的代码。
<?php
$today = date('m/d/Y');
include('config-db.php');
$sql = "SELECT * FROM employees";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$filename = "report.xls";
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=\"$filename\"");
$isPrintHeader = false;
// output data of each row
while ($row = mysqli_fetch_assoc($result)) {
$sql1 = "SELECT * FROM records WHERE employees_id =" . $row['id'];
$result1 = mysqli_query($conn, $sql1);
while ($row1 = mysqli_fetch_assoc($result1)) {
echo "Fecha";
echo "\t" . "Name";
echo "\t" . "In";
echo "\t" . "Break";
echo "\t" . "Break end";
echo "\t" . "Exit";
echo "\t" . "Others" . "\n";
echo "" . $row1["day"];
echo "\t" . $row["name"] + $row["apellido"];
echo "\t" . $row1["in"];
echo "\t" . $row1["break"];
echo "\t" . $row1["breakend"];
echo "\t" . $row1["exit"];
echo "\t" . $row1["others"];
}
}
}
mysqli_close($conn);
一切正常,但是当我将代码放入生产服务器时,即使我在代码上指定了文件格式,它也会给我一个.ods文件而不是xsl。
会发生什么?,一个朋友告诉我,这是因为服务器在Linux上运行,所以有没有办法强迫Linux创建xsl?