我得到以下代码:
<div style="border:1px solid #CCCCCC; background-color:#F0F0F0; font-family:verdana; font-size:12px; padding:5px;">
<?php
$dir = '../klanten';
// List of file names to exclude from output
// NOTE: This is case-sensitive
$exclude = array('klant_aanmaken.php','klanten_overzicht.php','klant_verwijderen.php','domein_aanmaken.php','domeinen_overzicht.php','domein_verwijderen.php','overzicht.php','documenten_toevoegen.php', 'dlf');
// Check to see if $dir is a valid directory
if (is_dir($dir)) {
$contents = scandir($dir);
echo '<strong>Selecteer klant: </strong><div class="styled-select"><select id="mydropbox">';
foreach($contents as $file) {
// This will exclude all filenames contained within the $exclude array
// as well as hidden files that begin with '.'
if (!in_array($file, $exclude) && substr($file, 0, 1) != '.') {
echo '<option>'. $file .'</option>';
}
}
echo '</select></div>';
}
else {
echo "The directory <strong>". $dir ."</strong> doesn't exist.";
}
?>
这显示所有目录都很好。只有我现在需要另一个选择框,它从上面显示所选目录中的目录。
或者有没有办法让这个选择框也显示子目录。
我试过复制这个脚本并改变它:
$dir = '../klanten'./.$file;
和
$dir = '../klanten/'.$file;
但两者都不起作用。提前感谢您的帮助。