Change the current directory:
<?php// Get current directoryecho getcwd() . "<br>";// Change directorychdir("images");// Get current directoryecho getcwd();?>result:
/home/php/home/php/imagesThe chdir() function changes the current directory.
chdir( directory );
parameter | describe |
---|---|
directory | Required. Specifies the new current directory. |
Return value: | Returns TRUE on success. On failure, FALSE is returned and an E_WARNING level error is thrown. |
---|---|
PHP version: | 4.0+ |