error_reporting( E_ALL); //Open error
set_time_limit(0); //Script does not timeout
date_default_timezone_set('Europe/London'); //Set time
/**Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . 'http://www.jb51.net/../Classes/');//Set environment variables
/**PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
//$inputFileType = 'Excel5'; //This is for reading xls
$inputFileType = 'Excel2007';//This is
//$inputFileName = './sampleData/example2.xls';
$inputFileName = './sampleData/book.xlsx';
echo 'Loading file ',pathinfo ($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
Get the total number of rows
$highestColumn = $sheet->getHighestColumn(); //Get the total rows
*/
$objWorksheet = $objPHPExcel->getActiveSheet(); //Get the total rows
$highestRow = $objWorksheet->getHighestRow();//Get the total number of columns
$highestRow = $highestRow $highestRow = = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);//Total number of columns
echo 'highestColumnIndex='.$highestColumnIndex;
echo "&
$headtitle=array();
for ($row = 1;$row <= $highestRow;$row++)
{
$strs=array();
=$objWorksheet ->getCellByColumnAndRow($col, $row)->getValue();
🎜> 'word2'=>"$strs[1]",
'word3'=>"$strs[2]",
'word4'=>"$strs[3]",
); }
?>
http://www.bkjia.com/PHPjc/328157.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328157.htmlTechArticle Without further ado, let’s go directly to the code. Copy the code as follows: ?php error_reporting(E_ALL); //Open Error set_time_limit(0); //The script does not timeout date_default_timezone_set('Europe/Lo...