PHP section
Header ("Content-type:application/vnd.ms-excel");
Header ("content-disposition:attachment;filename=export_test.xlsx");
$OutputExcel = S (' Outputexcel ');
$this->assign (' Outputexcel ', $OutputExcel)->display (' Test ');
HTML section
xmlns:x= "Urn:schemas-microsoft-com:office:excel"
xmlns= "HTTP://WWW.W3.ORG/TR/REC-HTML40" >
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
<style id= "Classeur1_16681_styles" ></style>
<body>
<div id= "classeur1_16681" Align=center x:publishsource= "Excel" >
<table x:str border=0 cellpadding=0 cellspacing=0 width=100% style= "Border-collapse:collapse" >
<tr>
<th> Serial Number </th>
<th> name </th>
<th> numbering </th>
<th> Personal Identification Code </th>
<th> ID Card </th>
</tr>
<?php foreach ($OutputExcel as $key = $value):?>
<tr>
<td>{$key +1}</td>
<td>{$value [' Stuff_nicname ']}</td>
<td>{$value [' Stuff_number ']}</td>
<td>{$value [' Stuff_code ']}</td>
<td>{$value [' Stuff_idcard ']}</td>
</tr>
<?php Endforeach?>
</table>
PHP export Excel, no garbled