How to change the current directory in php

藏色散人
Release: 2023-03-04 21:42:01
Original
2421 people have browsed it

php method to change the current directory: first create a PHP sample file; then obtain the current directory through the getcwd function; finally use the "chdir("images");" method to change the directory.

How to change the current directory in php

Recommended: "PHP Video Tutorial"

php chdir function changes the current directory

Example

Change the current directory:

"; // 改变目录 chdir("images"); // 获得当前目录 echo getcwd(); ?>
Copy after login

Result:

/home/php /home/php/images
Copy after login

Definition and usage

chdir( ) function changes the current directory.

Syntax

chdir(directory);
Copy after login

Parameters

directory required. Specifies the new current directory.

The above is the detailed content of How to change the current directory in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
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!