ted_chou12 Posted June 6, 2007 Share Posted June 6, 2007 When you do this: $file = fopen("board.txt", "w"); $write = fwrite($file, ""); fclose($file); if ($write == true) {echo "true";} if what you write into the txt file is blank, it will return false despite the txt file has been cleared. Is there anyways to make this return true? Thanks Ted. Link to comment https://forums.phpfreaks.com/topic/54433-solved-fwrite-txt-file-blank/ Share on other sites More sharing options...
trq Posted June 6, 2007 Share Posted June 6, 2007 If you just want to create a blank file use touch. Link to comment https://forums.phpfreaks.com/topic/54433-solved-fwrite-txt-file-blank/#findComment-269187 Share on other sites More sharing options...
ted_chou12 Posted June 6, 2007 Author Share Posted June 6, 2007 Thanks thorpe, what I wish to do is to empty the existing file, I found it on tizag. You do this: $file = fopen("board.txt", "w"); fclose($file); It will simply empty an existing file. Ted Link to comment https://forums.phpfreaks.com/topic/54433-solved-fwrite-txt-file-blank/#findComment-269201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.