admin_user.php
<?php
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
$objPHPExcel = new PHPExcel();
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);$objWriter->save("resume.xls");$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
?>
在模版页面admin_user.html中
<!--IF($dc)-->
<!--$objPHPExcel = new PHPExcel();iconv('utf-8", "gb2312", $filename);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save("resume.xls");
ob_clean();
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
Header('content-Type:application/vnd.ms-excel;charset=utf-8');
header("Pragma: public");
header("Expires: 0″);
header("Cache-Control:must-revalidate, post-check=0, pre-check=0″);
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-execl");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");;
header('Content-Disposition:attachment;filename="resume.xlsx"');
header("Content-Transfer-Encoding:binary");-->
<table cellpadding="0" cellspacing="1" class="list" id="tree_list" >
<tr>
<th width="7%">用户编号</th>
<th width="12%">用户名</th>
<th width="18%">EMAIL</th>
<th width="10%">注册时间</th>
<th width="10%">用户类型</th>
<th width="12%">最后登陆</th>
<th width="12%">登陆IP</th> </tr>
<!--$userlist AS $v-->
<tr align="center"> <td align="left" class="td1" style="text-align:center;"><span><a href="#">{v[uid]}</a></span></td>
<td class="ud" >{v[username]}</td>
<td class="od" >{v[email]}</td>
<td class="gd" >{run:}echo date('Y-m-d',$v[date_reg]){/run}</td>
<td class="td"><!--IF($v[usertype]==0)--><font color="green">普通用户</font><!--ELSEIF($v[usertype]==2)--><font color="green">套红人才</font><!--END--></td>
<td>{run:}echo date('Y-m-d',$v[date_login]){/run}</td>
<td>{v[iponline]}</td>
</tr>
<!--END-->
</table><!--$objWriter->save('php://output');-->
<!--END-->
出现乱码,从来没做过导出excel,是不是程序不对?求解
<?php
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
$objPHPExcel = new PHPExcel();
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);$objWriter->save("resume.xls");$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
?>
在模版页面admin_user.html中
<!--IF($dc)-->
<!--$objPHPExcel = new PHPExcel();iconv('utf-8", "gb2312", $filename);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save("resume.xls");
ob_clean();
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
Header('content-Type:application/vnd.ms-excel;charset=utf-8');
header("Pragma: public");
header("Expires: 0″);
header("Cache-Control:must-revalidate, post-check=0, pre-check=0″);
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-execl");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");;
header('Content-Disposition:attachment;filename="resume.xlsx"');
header("Content-Transfer-Encoding:binary");-->
<table cellpadding="0" cellspacing="1" class="list" id="tree_list" >
<tr>
<th width="7%">用户编号</th>
<th width="12%">用户名</th>
<th width="18%">EMAIL</th>
<th width="10%">注册时间</th>
<th width="10%">用户类型</th>
<th width="12%">最后登陆</th>
<th width="12%">登陆IP</th> </tr>
<!--$userlist AS $v-->
<tr align="center"> <td align="left" class="td1" style="text-align:center;"><span><a href="#">{v[uid]}</a></span></td>
<td class="ud" >{v[username]}</td>
<td class="od" >{v[email]}</td>
<td class="gd" >{run:}echo date('Y-m-d',$v[date_reg]){/run}</td>
<td class="td"><!--IF($v[usertype]==0)--><font color="green">普通用户</font><!--ELSEIF($v[usertype]==2)--><font color="green">套红人才</font><!--END--></td>
<td>{run:}echo date('Y-m-d',$v[date_login]){/run}</td>
<td>{v[iponline]}</td>
</tr>
<!--END-->
</table><!--$objWriter->save('php://output');-->
<!--END-->
出现乱码,从来没做过导出excel,是不是程序不对?求解
解决方案 »
- oauth开放协议,有人了解吗?
- 如何能用php把jpg图片转为bmp256色的
- 急!!!!!!求国际统一的des3的加密解密算法,各种语言
- 着急啊,导出EXCEL,里面怎么加上VBA和控件
- 无法让文本框获取到焦点。
- PHP连接sqlserver数据库,数据库中有名为BS3000+_001_2011这种带+号的数据库,无法选择进入该数据库??
- ecshop 2.7在首页怎么调用分类小的商品的 销售排行
- DISCUZ更新缓存过程的个人看法,欢迎讨论
- 页面无动作,5分钟后自动退出系统
- phpstudy连接不到数据库,,等
- 怎么样才能完全看懂源码和别人写的代码
- PHP采集的一个函数,高手帮我优化一下
在你填充的字段进行转码;
$objActSheet -> setCellValue($key.'1', transformUtf8($_totaltitle[$value]));//列值
//$objActSheet -> getColumnDimension($key) -> setWidth();//宽度
$objActSheet -> getStyle($key.'1') -> getAlignment() -> setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objActSheet -> setCellValue($key.($i+1), transformUtf8($ary[$i-1] -> $value));
$objActSheet -> getStyle($key.($i+1)) -> getAlignment() -> setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);transformUtf8是一个自己手写的转码函数;function transformUtf8($str){
if(!is_utf8($str)){
return iconv("gbk","utf-8",$str);
}
return $str;
}