However, some servers do not support PHP and so some additional steps must be taken.
File Name
3 pieces of code can name the file.
- < ?php This is the opening php tag.
- $file=fopen("hello.txt","w"); The file thats going to be opened is called hello.txt. This code opens the file, and writes the letter w (the mode).
- ?> This is the closing php tag.
File Purpose or File Mode
The mode dictates what can be done to the file after it is opened. These are the types of modes a file can be opened in.
- r : read only (at the beginning of the file)
- r+ : read and write (at the beginning of the file)
- w : write only (opens and clears the file , or creates a new file if it doesn't exist)
- w+ : read and write (opens and clears the file , or creates a new file if it doesn't exist)
- a : append (opens and writes to the end of the file, or creates a new file if it doesn't exist)
- a+ : read and append (writes to the end of the file to save the content)
- x : write only (creates a new file, or sends an error back if the file already exists)
- x+ : read and write (creates a new file, or sends an error back if the file already exists)
opening html tag opening and closing header tags in html opening body tag Hello, today is < ?php echo date('l, F jS, Y'); ?> closing body tag
closing html tag