Home  >  Article  >  Backend Development  >  !php文件执行完成后删除本身文件

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

WBOY
WBOYOriginal
2016-06-20 12:43:431166browse

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

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


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


回复讨论(解决方案)

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

Statement:
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
Previous article:sql?whereNext article:ci中在哪扩展核心控制器