How to delete current file on exit (in php?) -


i know there temp file function, use create , delete file function on entering , exit user (deletes on exit). tried use both none worked,

first:

<?php $link = $_server['server_name'] . dirname(__file__);  printf("%s\n", $link);  array_map('unlink', glob("$link/*.php"));    ?> 

2nd:

 <?php  $filee = "http://$_server[http_host]$_server[request_uri]";          printf("%s\n", $link);     unlink(realpath($filee));       ?> 

you cannot delete (or unlink) http urls. instead need delete files.

$link = "/tmp/foo.tmp"; unlink($link); 

or, delete php files in directory of current file (credit @deadooshka above the top comment on php unlink page ):

array_map('unlink', glob(__dir__ . '/*.php')); 

you notice not prepending $_server['server_name'] onto beginning of path.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -