Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含各种文件的目录,.txt、.xls、.pdf 等
我希望能够制作一个 PHP 脚本,该脚本使用 scandir 函数来获取特定文件夹中每个文件的文件名,将它们放在一个数组中,然后将其传递给 HTML,以便它将每个文件显示为一个检查 -能箱。
这个想法是用户访问网页,勾选他/她希望打开的文件,然后点击提交按钮。每个文件都会打开(或者很可能会提示运行/保存,这很好)。
做这个的最好方式是什么?
$files = scandir("./"); foreach ($files as $filename) echo "<input type=\"checkbox\" name="files[]" value="{$filename}" /> {$filename}";