Change the current directory:
<?php
// Get current directory
echo getcwd() . "<br>";
// Change directory
chdir("images");
// Get current directory
echo getcwd();
?>
Result:
/home/php
/home/php/images
The chdir() function changes the current directory.
chdir(
directory)
Parameter | Description |
---|---|
directory | Required. Specifies the new current directory |
Return Value: | TRUE on success. FALSE on failure. Throws an error of level E_WARNING on failure |
---|---|
PHP Version: | 4.0+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!