我找到了有關如何Read Excel File Data in PHP using PHPExcelReader的代碼。它在這裏說它支持xls和xlsx文件。但是,在查看xlsx文件時,它說該文件不可讀。它只在查看xls文件時才起作用。有什麼我可以添加在我的代碼,以使它可讀xlsx文件嗎?我也嘗試在網上搜索答案,但仍然可讀。請幫助我,謝謝你。PHP Excel讀取xlsx文件
<?php
$filename = "uploads/$filename";
$excel_file = $filename;
$sheet_data = '';
$table_output = array();
$max_rows = 0;
$max_cols = 0;
$force_nobr = 0;
require_once 'excel_reader.php';
$excel = new PhpExcelReader();
$excel->setOutputEncoding('UTF-8');
$excel->read($excel_file);
$nr_sheets = count($excel->sheets);
function make_alpha_from_numbers($number) {
$numeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if($number<strlen($numeric)) return $numeric[$number];
else {
$dev_by = floor($number/strlen($numeric));
return make_alpha_from_numbers($dev_by-1) .
make_alpha_from_numbers($number-($dev_by*strlen($numeric)));
}
}