Created
January 31, 2018 16:22
-
-
Save seanvree/a337158bd9cc32a0dbc9d5943628528a to your computer and use it in GitHub Desktop.
logarr_delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = 'example.txt'; | |
echo "$file\n"; | |
echo "<br>"; | |
$fh = fopen($file, 'a'); | |
fwrite($fh, '<h1>File deleted and backed up</h1>'); | |
fclose($fh); | |
if($fh == true) | |
echo "Write: success: $file\n"; | |
else | |
echo "Write: fail: $file\n"; | |
echo "<br>"; | |
$newfile = 'example.txt.bak'; | |
if (!copy($file, $newfile)) | |
echo "Copy: fail: $newfile"; | |
else | |
echo "Copy: success: $newfile"; | |
echo "<br>"; | |
$delete = unlink($file); | |
if($delete == true) | |
echo "Delete: success: $file\n"; | |
else | |
echo "Delete: fail: $file\n;"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment