阅读背景:

phpExcel 读取excel和csv格式

来源:互联网 
	/*以csv,xls,xlsx返回数据源*/
	private function create_reader_data($file) {
		import('ORG.Tools.PHPExcel.IOFactory');
		$type = strtolower( pathinfo($file, PATHINFO_EXTENSION) );
		if( $type=='xlsx'||$type=='xls' )
			$objPHPExcel = PHPExcel_IOFactory::load($file);
		elseif($type=='csv') {
			$objReader = PHPExcel_IOFactory::createReader('CSV')
								->setDelimiter(',')
								->setInputEncoding('GBK')
								->setEnclosure('"')
								->setLineEnding("\r\n")
								->setSheetIndex(0);
			$objPHPExcel = $objReader->load($file);
		}			
		$data = $objPHPExcel->getSheet()->toArray();
		array_shift($data);		
		return $data;
	}	/*以csv,xls,xlsx返回数据源*/
	private function creat



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: