for a read only file you do this
Code: Select all
<html>
<body>
<?php
$f=fopen("welcome.txt","r");
?>
</body>
</html>
r Read only. File pointer at the start of the file
r+ Read/Write. File pointer at the start of the file
w Write only. Truncates the file (overwriting it). If the file doesn't exist, fopen() will try to create the file
w+ Read/Write. Truncates the file (overwriting it). If the file doesn't exist, fopen() will try to create the file
a Append. File pointer at the end of the file. If the file doesn't exist, fopen() will try to create the file
a+ Read/Append. File pointer at the end of the file. If the file doesn't exist, fopen() will try to create the file
x Create and open for write only. File pointer at the beginning of the file. If the file already exists, the fopen() call will fail and generate an error. If the file does not exist, try to create it
x+ Create and open for read/write. File pointer at the beginning of the file. If the file already exists, the fopen() call will fail and generate an error. If the file does not exist, try to create it
add the leter thing you want in the quotes next to the .txt
the "are+" and "are" are supposed to be the letter are but it doesnt let me put it because it corrects it
these are all of the different file things you can do with your text documents
hope this helps