关于php读取excl的一些问题
include_once('PHPExcel.class.php');header("Content-type:text/html;charset=utf-8");//r...
include_once('PHPExcel.class.php');
header("Content-type: text/html; charset=utf-8");
//read excel file;
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel5();
$PHPExcel = $PHPReader->load('31excel5.xls');
$currentSheet = $PHPExcel->getSheet(0);
$allColumn = $currentSheet->getHighestColumn();
$allRow = $currentSheet->getHighestRow();
for($currentRow = 1; $currentRow<=$allRow; $currentRow++){
for($currentColumn='A'; $currentColumn<=$allColumn; $currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t";
}
echo "\n";
}
解释一下每一句。谢谢 展开
header("Content-type: text/html; charset=utf-8");
//read excel file;
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel5();
$PHPExcel = $PHPReader->load('31excel5.xls');
$currentSheet = $PHPExcel->getSheet(0);
$allColumn = $currentSheet->getHighestColumn();
$allRow = $currentSheet->getHighestRow();
for($currentRow = 1; $currentRow<=$allRow; $currentRow++){
for($currentColumn='A'; $currentColumn<=$allColumn; $currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t";
}
echo "\n";
}
解释一下每一句。谢谢 展开
2015-09-20 · 知道合伙人软件行家
关注
展开全部
include_once('PHPExcel.class.php'); //加载phpexcel类
header("Content-type: text/html; charset=utf-8"); //设置文字编码为utf8
//read excel file;
$PHPExcel = new PHPExcel(); //实例化phpexcel类
$PHPReader = new PHPExcel_Reader_Excel5(); //实例化文件类型类。。包括excel2007 csv 文件等
$PHPExcel = $PHPReader->load('31excel5.xls'); //加载要读取的文件
$currentSheet = $PHPExcel->getSheet(0); //取文件中的第一个表
$allColumn = $currentSheet->getHighestColumn(); //获取列数
$allRow = $currentSheet->getHighestRow(); //获取行数
for($currentRow = 1; $currentRow<=$allRow; $currentRow++){ //通过所有行数和列数循环读取表中的所有值
for($currentColumn='A'; $currentColumn<=$allColumn; $currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t"; //输出取到的表格中的值
}
echo "\n";
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |