Writting to a file

With this code you can create a new text file in the server

Use the funtion fopen( )

code in php

Create a variable $handle

Then use the funtion fopen( )

Inside the funtion you use two arguments, or two things. fopen( 'one', 'two' )

In the first one, you type the name of the file you want to create... "names.txt"

I have not try to create a "sky.jpg" for example, or a photoshop file.

I guess this works only for .txt files

In the second one, you tipe the letter w, like 'w', it means -write-


then you use the funtion fwrite( )

Inside you type also two things, or arguments.

One, you write the name of the file, you want to write in....

In the socend argument, you put, the string of text you want to write.


And finally don't forget to close the file

fclose ($handle);


Copyright 2017, July, 15