复制代码 代码如下:
<?php
header("Content-type:application/vnd.ms-excel");
header("Conten-Disposition:filename=hp.xlsx");
?>
复制代码 代码如下:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
header("Content-type:application/vnd.ms-excel");
header("Conten-Disposition:filename=hp.xlsx");
?>
<table>
<tr>
<td colspan="3">i love you</td>
</tr>
<tr>
<td>编号</td>
<td>姓名</td>
<td>年龄</td>
</tr>
<tr>
<td>1</td>
<td>test</td>
<td>20</td>
</tr>
<tr>
<td>2</td>
<td>test2</td>
<td>22</td>
</tr>
</table>
复制代码 代码如下:
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<?php
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=qianshou.xls");
mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("SET NAMES GBK");
$query="select * from city ";
$r=mysql_query($query);
?>
<table>
<tr>
<td colspan="3">城市列表</td>
</tr>
<tr>
<td>id</td>
<td>p_id</td>
<td>name</td>
</tr>
<?php
while($row=mysql_fetch_assoc($r)){
?>
<tr>
<td><?php echo $row[id] ?></td>
<td><?php echo $row[p_id] ?></td>
<td><?php echo $row[c_name]?></td>
</tr>
<?php
}
?>
</table>
新闻热点
疑难解答