How can PHP be used to create a directory in a specific location outside of the current directory?
To create a directory in a specific location outside of the current directory using PHP, you can use the `mkdir()` function with the full path of the directory you want to create. Make sure you have the necessary permissions to create directories in the specified location.
$directoryPath = '/path/to/new/directory';
if (!file_exists($directoryPath)) {
mkdir($directoryPath, 0777, true);
echo "Directory created successfully.";
} else {
echo "Directory already exists.";
}
Related questions
-
file systems PHP functions
-
file_exists PHP remote server
-
data organization table display PHP