如何将文件夹中的所有 .csv 内容显示到单个 HTML Table 或 PHP 或 Ajax 中的数据表中

How to display all .csv content from a folder into a single HTML Table or Datatable in PHP or Ajax

我已经用当前的代码更新了我的问题 post。希望有人能帮助我。

我似乎无法弄清楚如何将 CSV 中的所有值放入 HTML table

<?php
$files = glob("./data/*.csv");
foreach($files as $file) {
    if (($handle = fopen($file, "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 4096, ",")) !== FALSE) {
            echo implode("\t", $data);
        }
        echo "<br>";
        fclose($handle);
    } else {
        echo "Could not open file: " . $file;
    }
}
?>
<?php
$files = glob("./data/*.csv");
$display_csv = array();
foreach($files as $file) {
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$xyz = array('company_name'=>$data[0],'case_id'=>$data[1]);
array_push($display_csv, $xyz);
}
fclose($handle);
}else 
{
echo "Could not open file: " . $file;
}
}
echo "<table class='table table-dark table-striped' id='call_csv' border='2'><thead><tr><th>Company Name</th><th>Case ID</th></tr></thead><tbody>";
foreach($display_csv as $row){
echo "<tr><td>" . $row['company_name'] . "</td>";
echo "<td>" . $row['case_id'] . "</td></tr>";
}
echo "</tbody></table>";
?>