我有一个基本的PHP脚本,显示目录的文件内容.这是脚本:
<?php
$Dept = "deptTemplate";
if(isset($_REQUEST['dir'])) {
$current_dir = $_REQUEST['dir'];
} else {
$current_dir = 'docs';
}
if ($handle = opendir($current_dir)) {
while (false !== ($file_or_dir = readdir($handle))) {
if(in_array($file_or_dir, array('.', '..'))) continue;
$path = $current_dir.'/'.$file_or_dir;
if(is_file($path)) {
echo '`<a href="/Implementation/'.$Dept.'/'.$path.'">'.$file_or_dir.'</a> - [Delete button/link]<br/>`';
} else {
echo '`<a href="testFolderiFrame.php?dir='.$path.'">`'.$file_or_dir."\n`</a>` - [Delete button/link]`<br/>`";
}
}
closedir($handle);
}
?>
Run Code Online (Sandbox Code Playgroud)
我正在尝试创建一个显示在每个文件旁边的删除链接/按钮,单击此按钮时,将删除相应的文件.你知道怎么做吗?
| 归档时间: |
|
| 查看次数: |
6905 次 |
| 最近记录: |