我想创建一个函数或脚本来自动将报告存储到数据库中。但我不知道如何使该功能成为自动。任何人都可以帮助我吗?
this is database sample
<?php
include "database.php";
$path = "2021";
$dir_handle = @opendir($path) or die("Unable to open $path");
list_dir($dir_handle,$path);
function list_dir($dir_handle,$path)
{
echo "<ul>";
while (false !== ($file = readdir($dir_handle)))
{
$dir =$path.'/'.$file;
if(is_dir($dir) && $file != '.' && $file !='..' )
{
$handle = @opendir($dir) or die("undable to open file $file");
echo '<li><a href="#">'.$dir.'</a></li>';
list_dir($handle, $dir);
}
elseif($file != '.' && $file !='..')
{
echo '<li><a href="?f='.$file.'">'.$file.'</a></li>';(here is the report that i want to auto store into database.)
}
}
echo "</ul>";
closedir($dir_handle);
}
?>