Let a PHP file delete itself after executing it once

藏色散人
Release: 2023-03-04 18:42:01
Original
2280 people have browsed it

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.

Let a PHP file delete itself after executing it once

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);  
}
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template