我还是 PHP 新手,我正在尝试将文件夹中的文件回显到表格行。我可以成功地在服务器上回显文件,但我为文件类型尝试的所有内容都不起作用。到目前为止,我的代码如下所示:
<?PHP
$folder = "uploads/";
$handle = opendir($folder);
# Making an array containing the files in the current directory:
while ($file = readdir($handle))
{
$files[] = $file;
}
closedir($handle);
#echo the files
$path_parts = pathinfo($file);
foreach ($files as $file) {
echo "
<tr><td><a href=$folder$file>$file</a></td><td>$path_parts['extension']</td><td>date</td> </tr>"
;
}
?>
按照这种方式设置,它给了我一个服务器错误。当我取出路径部分/路径信息代码时,它工作正常,但当然它不会回显文件类型。对此的任何帮助将不胜感激,如果有人知道实现文件上传日期的最佳方法,那就太好了。顺便说一句,如果有任何区别,请使用 uploadifive 作为上传者。