Home > Article > Backend Development > PHP changes the current directory chdir() function usage
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!