Home >Backend Development >PHP Tutorial >mysql导出身份证到EXCEL为科学计数法,怎么处理

mysql导出身份证到EXCEL为科学计数法,怎么处理

WBOY
WBOYOriginal
2016-06-13 10:07:351887browse

mysql导出身份证到EXCEL为科学计数法,怎么办?
我是通过PHPExcelClasses如下方法将MYSQL数据导出到EXCEL里,但是当为身份证时, 就变为科学计数法,有什么办法可以提前将要导入身份证号的EXCEL字段设置为文本,来正常显示身份证吗?
set_include_path(get_include_path() . ";" . '../Common/PHPExcelClasses/');
include 'PHPExcel.php';
//或者include 'PHPExcel/Writer/Excel2007.php';
include 'PHPExcel/Writer/Excel5.php'; //用于输出.xls的
//创建一个excel
$objPHPExcel = new PHPExcel();
//保存excel—2007格式
//$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
//$objWriter->setOffice2003Compatibility(true);
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel); /
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', '学员编号');
$objPHPExcel->getActiveSheet()->setCellValue('B1', '身份证号');
..............................
$objWriter->save("info.xls");

------解决方案--------------------
use string type
------解决方案--------------------
导出的值前加 符号表空格,会自动转为字符
------解决方案--------------------
导出的值前加一个半角的单引号
------解决方案--------------------

探讨
现在是身份证前不能加什么符号的,一楼的什么意思, 怎么用
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn