PHP chdir() 函数

PHP Directory PHP Directory 参考手册

实例

改变当前的目录:

<?php
// Get current directory
echo getcwd() . "<br>";

// Change directory
chdir("images");

// Get current directory
echo getcwd();
?>

结果:

/home/php
/home/php/images


定义和用法

chdir() 函数改变当前的目录。


语法

chdir(directory);

参数描述
directory必需。规定新的当前目录。

技术细节

返回值:成功则返回 TRUE。失败则返回 FALSE,且抛出 E_WARNING 级别的错误。
PHP 版本:4.0+


PHP Directory PHP Directory 参考手册

0 个评论

要回复文章请先登录注册