Jump to content

PLS CAN THIS WORKS?


Oliverkahn

Recommended Posts

can this work???

 

<?PHP

$file_handle = fopen("testFile.html", "w");

$file_contents = "Some test text";

fwrite($file_handle, $file_contents);

fclose($file_handle);

print "file created and written to";

?>

 

instead of this...

 

<?PHP

$file_handle = fopen("testFile.txt", "w");

$file_contents = "Some test text";

fwrite($file_handle, $file_contents);

fclose($file_handle);

print "file created and written to";

?>

Link to comment
https://forums.phpfreaks.com/topic/287788-pls-can-this-works/
Share on other sites

Yes, you can write to different file types; it may depend on the system what your actual result is.  For the most part, in a server environment, the content determines the way it's handled.

You might also look into using file_put_contents() instead of the fopen/fwrite/fclose routine, if possible.

Link to comment
https://forums.phpfreaks.com/topic/287788-pls-can-this-works/#findComment-1476263
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.