GRPsuper Posted April 15, 2006 Share Posted April 15, 2006 what is the code i would need if i wanted to delete all text in a php file with a chmod set to 7,7,7,7? Quote Link to comment https://forums.phpfreaks.com/topic/7486-deleting-text-in-a-file/ Share on other sites More sharing options...
wildteen88 Posted April 15, 2006 Share Posted April 15, 2006 Use fopen to open the file then fwrite that'll erase al data in the file. Quote Link to comment https://forums.phpfreaks.com/topic/7486-deleting-text-in-a-file/#findComment-27335 Share on other sites More sharing options...
ypirc Posted April 16, 2006 Share Posted April 16, 2006 Follow what wildteen stated, but make sure your fopen mode is set to either "w" or "w+". Alternatively, you can also use file_put_contents if you are using PHP 5+ or you could also use unlink which will remove the file and then you can recreate it at your will. As you can see there are several possibilities. I suggest checking out www.php.net/filesystem Quote Link to comment https://forums.phpfreaks.com/topic/7486-deleting-text-in-a-file/#findComment-27388 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.