Home > Backend Development > PHP Tutorial > PHP changes the current directory chdir() function usage

PHP changes the current directory chdir() function usage

怪我咯
Release: 2023-03-13 12:24:02
Original
1601 people have browsed it

chdir() FunctionChange the current directory. This function returns TRUE if successful. On failure, FALSE is returned and an E_WARNING level error is thrown.

Example code

<?php
if (chdir("upload")) { 
   print "Changed current directory successfully"; 
}
?>
Copy after login

Output result:

Changed current directory successfully 
Explanation:
This code changes the working directory to the upload directory in the previous working directory.
Copy after login

The above is the detailed content of PHP changes the current directory chdir() function usage. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template