Home » Interview » Technology

How to create a basic text file in php?

Correct Answer: $filename = "/home/user/guest/newfiletxt"; $file = fopen( $filename, "w" ); if( $file == false ) { echo ( "Error in opening new file" ); exit(); } fwrite( $file, "This is a simple test\n" ); fclose( $file );

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion