PHP Chdir() Function Changes To File Directory. – String Function

 
Its syntax is: int chdir (string directory)<?
    $newdir = "book";
    chdir($newdir) or die("Could not change to directory ($newdir)");
    $dh = opendir('.');
    print "Files:";
    while ($file = readdir($dh)) :
         print "$file <br />";
    endwhile;
    closedir($dh);
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.