1. 程式人生 > >PHP匯出資料到EXCEL,防止以0開頭的大數字變成科學計數

PHP匯出資料到EXCEL,防止以0開頭的大數字變成科學計數

header("Content-Type: application/vnd.ms-excel");
Header("Accept-Ranges:bytes");
Header("Content-Disposition:attachment;filename=out.xls"); //$filename匯出的檔名
header("Pragma: no-cache");
header("Expires: 0");
/*if($filename_type==’xls’){
echo ‘
<!–[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>

<x:ExcelWorksheet>
<x:Name></x:Name>
<x:WorksheetOptions>
<x:DisplayGridlines/>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml><![endif]–>
‘;
}*/
echo ‘<table>
<tbody>
<tr>
<td style="vnd.ms-excel.numberformat: @;">023165465465</td>

</tr>
</tbody>
</table>’;