Discover delete file in folder php, include the articles, news, trends, analysis and practical advice about delete file in folder php on alibabacloud.com
PHP File Operations Summary (delete the specified file/Get folder under the file name/read the folder name),
This paper analyzes the methods of PHP file operation. Share to everyone for your reference, as follows:
First, delete the file
Unlink
PHP provides functions such as filesize, copy, unlink, and so on, but does not provide functions such as dirsize, Copydir, Rmdirs and Other folder operations (RmDir can only delete empty directories). So you can only write these functions manually,
Create the fileutil.php file with the following content and invocation methods:
Php/** * manipulating File class * * Example: * Fileutil::createdir (' A/1/2/3 '); Test build folder Build a A/1/2/3 folder * fileutil::createfile
a more comprehensive set of PHP tutorials , basic video and some small combat projects, below is the video directoryCD-ROM (i) \php employment Class (I.)CD-ROM (i) \php Technical exchange zone. URLCD-ROM (i) \ "Wisdom Special issue" belongs to it
This article mainly introduces php file operations, including deleting a specified file, obtaining the file name under a folder, and reading the folder name. it involves common php operations on files and directories, for more information about php
Copy CodeThe code is as follows:
/**
* Manipulating file Classes
*
Example
* Fileutil::createdir (' A/1/2/3 '); Test build folder Build a A/1/2/3 folder
* Fileutil::createfile (' B/1/2/3 '); Test build file Build a 3 file under the b/1/2/folder
*
Copy Code code as follows:
?
/**
* Manipulating file Classes
*
Example
* Fileutil::createdir (' A/1/2/3 '); Test build folder Build a A/1/2/3 folder
* Fileutil::createfile (' B/1/2/3 '); Test build file Build a 3 file under the
This article analyzes the method of PHP file operation. Share to everyone for your reference, specific as follows:
Delete a file
Unlink ()
Syntax: int unlink (string filename);
return value: Integer
Function type: file access. Such as:
This article mainly introduces php file operations, including deleting a specified file, obtaining the file name under a folder, and reading the folder name. it involves common php operations on files and directories, for more information about php
1
2 $dir = ' directory path you want to delete '; As follows:
3//$dir = $_server[' Document_root '). ' /cache ';
4 Rmdirs ($DIR);
5
6//php Delete files in the specified directory-How do I delete a file specified under a directory in PHP?
7 function
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.