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

PHP changes the current directory chdir() function usage

怪我咯
怪我咯Original
2017-07-10 15:22:231475browse

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"; 
}
?>

Output result:

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

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!

Statement:
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