How to Delete a file in PHP

Home >> Blog >> How to Delete a file in PHP
By Admin Sep 04, 2020

How to Delete a file in PHP: PHP Delete File
Syntax: unlink(FILE_PATH); Example: unlink(‘log.txt’);
Note: This function will return TRUE on success or FALSE on failure. In order for this to be successful, the following condition must be true.
  1. The file must be closed
  2. The web app must have write permission on the folder that contains the file.
You may also like - Core PHP Interview Questions
#Example
You may also like - Node js Interview Questions