PHP chdir() 函数

PHP 教程 · 2019-01-24 11:59:20

实例

改变当前的目录:

<?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 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Head First 设计模式(中文版)

Head First 设计模式(中文版)

弗里曼 / O'Reilly Taiwan公司 / 中国电力出版社 / 2007-9 / 98.00元

《Head First设计模式》(中文版)共有14章,每章都介绍了几个设计模式,完整地涵盖了四人组版本全部23个设计模式。前言先介绍这本书的用法;第1章到第11章陆续介绍的设计模式为Strategy、Observer、Decorator、Abstract Factory、Factory Method、Singleton,Command、Adapter、Facade、TemplateMethod、I......一起来看看 《Head First 设计模式(中文版)》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具