php导入到Excel 的 utf8、gbk 编码
php导入到excel-支持utf8和gbk两种编码
php导入到excel乱码是因为utf8编码在xp系统不支持所有utf8编码转码一下就完美解决了
utf-8编码案例
<?php
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/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=11.xls ");
header("Content-Transfer-Encoding: binary ");
?>
<?
$filename="php导入到excel-utf-8编码";
$filename=iconv("utf-8", "gb2312", $filename);
echo $filename;
?>
gbk编码案例
<?php
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/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=11.xls ");
header("Content-Transfer-Encoding: binary ");
?>
<?
$filename="php导入到excel-utf-8编码";
echo $filename;
?>
访问网站的时候就下载到excel里面
要弄单元格区别的话
用table表格做网页的就可以了
相关文档:
在PHP中有urlencode()、urldecode()、rawurlencode()、rawurldecode()这些函数来解决网页
URL编码解码问题。
在ASP的时候URL编码解码很是恼火,Server.urlencode不太好用,遇到utf-8编码的地址更是麻
烦。你要获取百度、Google点击到网站的网址链接中的关键字,要写上一堆自定义函数来得到urldecode的效果。
摘录一篇关 ......
1
<?
2
/*
*
3
* filename: ext_page.class.php
4
* @package:phpbean
5
* @author :feifengxlq<feifengxlq#gmail.com><[url=http://www.phpobject.net/]http://www.phpobject.net/[/url]>
& ......
作者:Martin Streicher, 软件开发人员, Pixel, Byte, and Comma
尽管编写一个 PHP 扩展并不是很困难,而 SWIG 的确进一步简化了这项任务,这主要是因为它自动化了结合 PHP 与 C 或 C++ 所需的工作。若给定对一个函数的描绘 — 函数的名称及其形参 — SWIG 就会生成一个包装程序来将 PHP 与低层代码连接起来。
......
一:结构和调用(实例化):
class className{} ,调用:$obj = new className();当类有构造函数时,还应传入参数。如$obj = new className($v,$v2...);
二:构造函数和析构函数:
1、构造函数用于初始化:使用__construct(),可带参数。
2、但析构函数不能带参数(用于在销去一个类之前执行一些操作或功能)。析构函数用 ......
在PHP中修补XSS漏洞,我们可以使用三个PHP函数。
这些函数主要用于清除HTML标志,这样就没办法注入代码了。使用更多的函数是htmlspecialchars() ,它可以将所有的"<"与">"符号转换成"<" 与">;"。其它可供选择的函数还有htmlentities(), 它可以用相应的字符实体(entities)替换掉所有想要替换掉的特征码(cha ......