php生成word文档
2024-10-21 10:28:44
使用fopen文件操作函数来做,需要注意的直接生成中文文件名会乱码,(生成word和微软的编码不一样)需要转码生成。word内容保持utf8编码就好。
$file_name = iconv("UTF-8", "GBK", $detail['name']);
$fp = fopen('./uploads/'.$file_name.'_'.$userid.'.doc', 'w+');
$fileContent = '';
$fileContent.= "姓名:".$detail['name']."\r\n";
$fileContent.= "性别:".$detail['sex']."\r\n";
$fileContent.= "会员级别:".$detail['member_type']."\r\n";
$fileContent.= "职务:".$detail['zhiwu']."\r\n";
$fileContent.= "联系电话:".$detail['phone']."\r\n";
$fileContent.= "邮箱:".$detail['email']."\r\n";
$fileContent.= "公司名称:".$detail['gongsi']."\r\n";
$fileContent.= "公司地址:".$detail['gongsi_dizhi']."\r\n";
$fileContent.= "助理电话:".$detail['zhuli_dianhua']."\r\n";
$fileContent.= "助理姓名:".$detail['zhuli_mingzi']."\r\n";
$fileContent.= "助理邮箱:".$detail['zhuli_youxiang']."\r\n";
fwrite($fp, $fileContent);
fclose($fp);
echo "<script>alert('添加成功');window.location.href='".site_url()."/index/joinUs';</script>";
最新文章
- nginx配置入门
- 速度!!!抢KIS英文版(多设备版)3年激活码
- onClick(View) of type new View.OnClickListener(){} must override a superclass method
- COB(Chip On Board)的製程簡單介紹
- python中变量命名
- 在C语言中基本数据类型所占的字节数
- codeforces 659C Tanya and Toys
- Android调试优化篇
- java数据结构之有序表查找
- Ubuntu中创建Python虚拟环境
- &ldquo;正在注册字体&rdquo;问题解决
- Scala_关键字
- 查看python中已安装的包有哪些
- Python3基础 __doc__ 单行与多行函数文档
- linux之tmpfs
- C#线程篇---让你知道什么是线程(1)
- Redis学习十一:Redis的Java客户端Jedis
- python接口自动化3-自动发帖(session)
- linux centOs中安装好数据库,客户端用plsql连接oracle
- @ResponseBody注解返回中文乱码
热门文章
- Ubuntu/CentOs 搭建SVN服务器
- BZOJ4011: [HNOI2015]落忆枫音(dp 乘法原理)
- LintCode2016年8月22日算法比赛----克隆二叉树
- [算法练习]Excel Sheet Column Title
- Grunt入门学习之(3) -- Gruntfile具体示例
- C#中的基础数据类型
- 秒杀多线程第一篇 多线程笔试面试题汇总 ZZ 【多线程】
- python之内置函数,匿名函数
- 字典构造、合并(dict)、排序
- JFinal启动报错:Exception in thread ";main"; java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector