日期:2014-05-16 浏览次数:20429 次
include_once 'DB_connmssql.php';
header("Content-Type:text/html;charset=utf-8");
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename=tt-".date('Y-m-d',time()).".xls");//定义生成的文件名
$sql="xxx ";
$query = mssql_query($sql_initbest);
$x=1;
while($row=mssql_fetch_array($query)){
if($x>=1){
//生成excel的列名
echo iconv("utf-8","gbk",'Store Code')."\t";
//。。。。。
echo iconv("utf-8","gbk",'% of total quantity sold')."\t";
$x--;
}
//$row['Store_name']=iconv('gb2312','utf-8',$row['Store_name']); 表中有中文需要像这样处理
echo "\n";
//以下为生成行
echo iconv("utf-8","gbk",$row['Store_number'])."\t";
//。。。。。
echo iconv("utf-8","gbk",$row['other_pss'])."\t";
}
?>