目录管理函数库_PHP

WBOY
Release: 2016-06-01 12:38:40
Original
923 people have browsed it

兼容:(PHP 3, PHP 4, PHP 5)
chdir -- 改变目录
语法:bool chdir ( string directory )
返回值:整数
函数种类: 文件存取

内容说明:
将 PHP 的当前目录改为directory。directory:新的当前目录。返回值如果成功则返回 TRUE,失败则返回 FALSE。


例子讲解:
php

// current directory

echo getcwd() . "\n\";

chdir('public_html');

// current directory

echo getcwd() . \"\n\";

?>

输出结果为:

/home/vincent

/home/vincent/public_html
 

注意:循环语句中会出现“ Warning: chdir(): No such file or directory (errno 2) in ***** on line *”错误。
php

// current directory

echo getcwd() . "\n\";

for($i=1; $i
    chdir('whoist');

// current directory

echo getcwd() . \"\n\";

}

?>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!