Home > Article > Backend Development > Let a PHP file delete itself after executing it once
How PHP deletes itself: First create a PHP sample file; then use the "$file = "zzz.php"; if (file_exists($file)) {@unlink ($file);}" method Just delete it.
Recommended: "PHP Video Tutorial"
Many friends need to make the file only accessible when using php Access once, (such as cms program installation, database query or modification) then how to let php delete itself, we can use the following code to complete:
$file = "zzz.php"; if (file_exists($file)) { @unlink ($file); }
Specify $file as zzz.php, then when When the program runs here, the file zzz.php will be deleted. Of course, you can also specify $file as the php code itself.
The above is the detailed content of Let a PHP file delete itself after executing it once. For more information, please follow other related articles on the PHP Chinese website!