How to use php rmdir function

藏色散人
Release: 2023-04-05 10:56:02
Original
3218 people have browsed it

The rmdir() function is a built-in function in PHP, used to delete empty directories. The syntax is rmdir(dir,context), which takes the directory to be deleted as a parameter. It returns True when successful and False when failed. NOTE: The directory must be empty and you must have the relevant permissions required to delete the directory.

How to use php rmdir function

php How to use the rmdir() function?

Function: Delete empty directories.

Syntax:

rmdir(dir,context)
Copy after login

Parameters:

dir: Required. Specifies the directory to be deleted.

context: Required. Specifies the environment for a file handle. Context is a set of options that modify the behavior of the stream.

Description: Try to delete the directory specified by dir. The directory must be empty and must have appropriate permissions.

php rmdir() function example

<?php
$dir = rmdir("newFile");
if($dir)
{
    echo "目录删除成功";
}else{
    echo "目录删除失败";
}
?>
Copy after login

This article is an introduction to the PHP rmdir function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use php rmdir function. 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