我是php的新手 我想读取一个Excel文件并将其显示在网页上 然后按列对记录进行排序
例如,我想过滤第一列,我有一个组合框可供选择 A列中的值。选择该值后,php页面仅显示 记录与该值相关的内容。
<!doctype>
<html>
<head>
</head>
<body>
<?php
require_once "PHPExcel/PHPExcel-1.8/Classes/PHPExcel.php";
$tmpfname = "0119.xlsx";
$excelReader = PHPExcel_IOFactory::createReaderForFile($tmpfname);
$excelObj = $excelReader->load($tmpfname);
$worksheet = $excelObj->getSheet(0);
$lastRow = $worksheet->getHighestRow();
echo "<table>";
for ($row = 1; $row <= $lastRow; $row++) {
echo "<tr><td>";
echo $worksheet->getCell('A'.$row)->getValue();
echo "</td><td>";
echo $worksheet->getCell('B'.$row)->getValue();
echo "</td><td>";
echo $worksheet->getCell('C'.$row)->getValue();
echo "</td><td>";
echo $worksheet->getCell('D'.$row)->getValue();
echo "</td><tr>";
}
echo "</table>";
?>
</body>
</html>