Php
!--? php Header ("content-type:text/html;charset=gb2312");
//This is the excel_reader2.php package for the home of the download script! Baidu is under the!
require_once ' excel/excel_reader2.php ';
$dir = "wps/";//Store folder name
$handle =opendir ($dir. ".");//Open Directory
$row =array ();
while (false!== ($file = Readdir ( $handle))
{
if ($file! = "." && $file! = "...") {
$row []= $dir. $file;//output filename
//echo $file;
}
}
Closedir ($handle);//Close Open Directory
//print_r ($row);
$data = new Spreadsheet_excel_reader ();
$data->setoutputencoding (' GB2312 ');//Set Text output encoding
//Read Excel file
//The problem starts here, the following loops the Excel document, but the output is always the same!
//for ($k =0; $k $data->read ($row [0]);//This is the function inside the package, read the Excel document
//$data->sheets[0][' NumRows '] is the number of rows in Excel
for ($i = 1; $i <= $data->sheets[0][' numrows '); $i + +) {
}
//}
//$data->sheets[0][' NumRows '] is an array, to fetch the $ data->sheets[0][' NumRows '][2] the contents of each line (my table is a total of two rows, all the tables are the same!) The first behavior header, to read the contents of the second line, so 2), here after the loop, the array is always the same, the loop content is always the first read content! Ask the Master to recycle all the contents of the document!
print_r($data->sheets[0]['cells'][2]);
?>