chdir
chdir
Change directory
bool **chdir** string $directory
Changes PHP's current directory to
.
directory
directoryThe new current directory
return.success
Throws an error of level on failure.
E_WARNING
Voorbeeld: example
<?php
// current directory
echo getcwd() . "\n";
chdir('public_html');
// current directory
echo getcwd() . "\n";
?>
/home/vincent
/home/vincent/public_html
Let op: > If the PHP interpreter has been built with ZTS (Zend Thread Safety) enabled, any changes to the current directory made through will be invisible to the operating system. All built-in PHP functions will still respect the change in current directory; but external library functions called using will not. You can tell whether your copy of PHP was built with ZTS enabled using or the built-in constant .
chdirFFIPHP_ZTS
getcwd