Define and use the unlink () function to delete a file. If successful, returns True, which returns false if it fails. The syntax unlink (filename,context) parameter describes the filename required. Specifies the files to be deleted. The context is
deleting files and directories in PHP is actually very simple as long as two functions one is unlink a rmdir function, if you want to implement delete directories and directories under the file we need to use the recursive operation.
Function code:
deleting files and directories in PHP is actually very simple as long as two functions one is unlink a rmdir function, if you want to implement delete directories and directories under the file we need to use the recursive operation. This article
This time for everyone to bring PHP unlink and rmdir Delete directory within the file how to implement, PHP unlink and rmdir Delete directory files in the attention of the matter, the following is the actual case, together to see.
Function code:
The unlink () function deletes files, the mkdir () function creates directories, and the rmdir () function deletes directories. these methods are often used in file-related processing methods, you may want to know about unlink () function deletion
In PHP we want to delete a specified file we can use the unlink function to implement, below I give you detailed description of the unlink function to delete a specified file of the specific method, there is a need to know the friend can refer
The function link, linkat, unlink, Unlinkat, and remove instance programs open a file and then unlink it. The process that executes the program then sleeps for 30 seconds and then terminates.
#include "apue.h"
#include
int
Usage of unlink (), mkdir (), and rmdir () in php
Unlink () function use instance
// Use the unlink function to delete an object
$ Filename = "data.txt"; // defines the variable
Function code: Deletes only the files in the specified directory, and does not delete the directory folder.
The code is as follows
Copy Code
Class Shanchu {All files under the looping directoryfunction Delfileunderdir
Unlink () function deletes file, mkdir () function creates directory, RmDir () function deletes directory
Copy Code code as follows:
unlink () function Use example
?
To delete a file using the Unlink function
$filename =
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.