Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Get Directory List

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36667
    iehsan
    Member

    Hi Friends.
    The Code not worked! Help Please!

    			
    $p = "";
    $projectsListIgnore = array('.','..',$theme);
    $handle=opendir("../themes");
    $projectContents = '.';
    while ($file = scandir("."))
    {
    if (!in_array($file,$projectsListIgnore))
    {
    $p .= '

    '.$file.''.$file.' Set As Default Theme - Delete Files

    ';
    }
    }
    echo $p;
    ?>

    It’s Error:
    Fatal error: Maximum execution time of 30 seconds exceeded in C:xampphtdocsishort2backthemes.php on line 53

    #96745
    bungle
    Member

    which line is line 53?

    I am not sure why you are doing

    while ($file = scandir(".")) 

    I think you should be doing

    while ($file = scandir($handle)) 

    FWIW to get a directory list I normally do


    $dir = "/mydirectory";
    if (file_exists($dir)) {
    $dir = opendir($dir);
    while (false !== ($filelist = readdir($dir))){
    if (in_array($filelist, array(".", "..", ".htaccess", ))) continue;
    echo $filelist;
    }
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.