10 articles about phprmdir () functions are recommended.

Source: Internet
Author: User
First, we will introduce the rmdir () function. Phprmdir () function rmdir-delete empty directory syntax: boolrmdir (string $ dirname [, resource $ context]) try to delete the directory specified by dirname. The directory must be empty and have the corresponding permissions. An error at the E_WARNING level will be generated when a failure occurs. Parameter: 1. dirname: directory path. & Amp; nbsp; 2. co... first introduce the rmdir () function. Php rmdir () function rmdir-delete empty directory syntax: bool rmdir (string $ dirname [, resource $ context]) try to delete the directory specified by dirname. The directory must be empty and have the corresponding permissions. An error at the E_WARNING level will be generated when a failure occurs. Parameter: 1. dirname: directory path. 2. context: added Context support in PHP 5.0.0. Php rmdir () is used to delete non-empty directories. as mentioned above, the rmdir () function can only delete empty directories. if it is not empty, you must first enter the directory and use unlink () the function deletes each file in the directory, and then returns to delete the empty directory. If there are subdirectories in the directory and the directory is not empty, you need to use recursive methods. The source code for deleting a Directory using a custom recursive function is as follows:

1. php rmdir use recursive functions to delete non-empty directory instances

Introduction: php, directory: Directory of PHP: Directory operation create directory mkdir (path, permission, recursive creation) delete directory rmdir () move (rename) rename () get the directory content // open the directory handle = opendir () // read the directory file name = readdir (Directory handle) read the file name in sequence, and move the file handle pointer down, if no value is obtained, false is returned. // Close the directory closedir () to recursively read the directory content.

9. how to retrieve the deleted files from the recycle bin in PHP and delete files and folders

Introduction: how to retrieve deleted files from the recycle bin, and how to use the unlink and rmdir functions for deleting files and folders in PHP

10. acronis disk director rrmdir php recursively deletes files in directories and directories.

Introduction: acronis disk ctor: acronis disk director rrmdir php recursively deletes files in directories and directories: Code: function rrmdir ($ dir) {if (is_dir ($ dir )) {$ objects = scandir ($ dir); foreach ($ objects as $ object) {if ($ object! = "." & $ Object! = "..") {If (filetype ($ dir. "/". $ objec

[Related Q & A recommendations ]:

Node. js-it is known how nodejs deletes folders but Files

Failed to rename directory in php

The above is a detailed article about the php rmdir () function. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.