search

Home  >  Q&A  >  body text

Dear gentlemen, I would like to ask you a question. Every time I select a directory, a corresponding picture will pop up. How should I do this?

<select class="span6 disabled" style="padding-left: 0px;" id="val-select2" name="path" style="width: 100%;" data-placeholder="Select page " tabindex="-1" aria-hidden="true" aria-describedby="val-select2-error" aria-invalid="false">

<option value="<?php echo $setting['path']; ?>"><?php echo $setting['path']; ?>(Do not select this)</option>

< ;?php

function traverseDir($dir){

if($dir_handle = @opendir($dir)){

while($filename = readdir($dir_handle )){

if($filename != "." && $filename != ".."){

$subFile = $dir.DIRECTORY_SEPARATOR.$filename; //To convert Source directory and sub-file are connected

if(is_dir($subFile)){ //If the sub-file is a directory

echo '<option value="theme/'.$filename.'" >'.$filename.'</option>';

traverseDir($subFile); //Recursively find the name of the subordinate directory

}

}

}

closedir($dir_handle);

}

}

echo traverseDir(ROOT.'../theme/' );

?>

</select>


yz666yz6661921 days ago1191

reply all(2)I'll reply

  • 秋香姐家的小书童

    秋香姐家的小书童2019-08-14 10:52:57

    I don’t quite understand what you mean

    reply
    0
  • yz666

    Isn't it me who can judge the contents of the folders under the theme folder? Then I think, for example, when option value="theme/abc/index.php", by the way, a picture introduction of abc/index.php will pop up. If it is cba/index.php, a picture introduction of cba will pop up.

    yz666 · 2019-08-14 10:57:58
  • Cancelreply