chdir 改变目录 php函数


chdir

(PHP 4, PHP 5)

chdir改变目录

说明

bool chdir ( string $directory )

将 PHP 的当前目录改为 directory

参数

directory

新的当前目录

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE.

范例

Example #1 chdir() 例子

<?php

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

chdir('public_html');

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

?>

以上例程的输出类似于:

/home/vincent
/home/vincent/public_html

注释

Note: 当启用 安全模式时, PHP 会在执行脚本时检查被脚本操作的目录是否与被执行的脚本有相同的 UID(所有者)。

参见


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3