!php文件执行完成后删除本身文件

WBOY
Release: 2016-06-20 12:43:43
Original
1165 people have browsed it

一个自动创建文件并写入内容的a.php文件,代码如下

<?php $counter_file   =   'b.php ';$fopen =   fopen($counter_file,   'wb '); fputs($fopen,   '<?php内容?>'); fclose($fopen); ?>
Copy after login


怎样让a.php在生成文件并写入内容完成之后自动删除a.php,求大神给个完整代码,先谢谢了


回复讨论(解决方案)

<?php $counter_file   =   'b.php ';$fopen =   fopen($counter_file,   'wb '); fputs($fopen,   '<?php内容?>'); fclose($fopen);unlink(__FILE__);?>
Copy after login

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!