您好,欢迎访问一九零五行业门户网

php excel读取 excel下拉菜单怎么做 excel2013官方下载 excel2007

当然首先要判断是否有文件和文件类型,接着把文件保存到某个路径中
/** * 读取excel数据 * @author red * @date * @param $filename 文件所在路径+文件名 * @param string $encode * @param $file_type * @return array */function readexcel($filename, $encode = 'utf-8', $file_type){ include './plugins/excel/phpexcel.php'; include './plugins/excel/phpexcel/reader/excel2007.php'; include './plugins/excel/phpexcel/writer/excel5.php'; include './plugins/excel/phpexcel/writer/excel2007.php'; if ($file_type == 'xlsx') { $objreader = phpexcel_iofactory::createreader('excel2007'); } else { $objreader = phpexcel_iofactory::createreader('excel5'); } $objreader->setreaddataonly(true); $objphpexcel = $objreader->load($filename); $objworksheet = $objphpexcel->getactivesheet(); $hightestrow = $objworksheet->gethighestrow(); $highestcolumn = $objworksheet->gethighestcolumn(); $highestcolumnindex = phpexcel_cell::columnindexfromstring($highestcolumn); $exceldata = array(); //从第二行开始 for ($row = 2; $row $hightestrow; $row++) { for ($col = 0; $col $highestcolumnindex; $col++) { $exceldata[$row][] = (string)$objworksheet->getcellbycolumnandrow($col, $row)->getvalue(); } } return$exceldata;}
以上就介绍了php excel读取,包括了excel方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息