一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php chdir 改变目录函数教程

时间:2009-04-25 编辑:简简单单 来源:一聚教程网

chdir -更改目录

描述
布尔chdir (字符串$目录)
更改PHP的当前目录的目录。

参数

目录
新的当前目录


返回值
返回TRUE或FALSE的成功失败。

实例

例如# 1 chdir ( )的例子

// current directory
echo getcwd() . "n";

chdir('public_html');

// current directory
echo getcwd() . "n";

?>

$path="c:temp"';
chdir($path);
getcwd()
gives you back "c:temp"

$path="c:temp"';
chdir($path);
getcwd()
gives you back "c:temp"

to work around this inconsistency
doing a chdir('.') after the chdir always gives back "c:temp"

 

上面的例子将输出类似于:

/首页/文
/首页/文/ public_html


注:如果安全模式被激活, PHP将检查是否目录该脚本的操作具有相同的UID (所有者)的脚本,正在执行。

又见

getcwd ( ) -获取当前工作目录

热门栏目