私は次のコードを取得しました:
<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;
しかし、両方とも機能していません。助けてくれてありがとう。