i want to be able to create a file and put some code in it
- Forums
- PHP
- i want to be able to create a file and put some code in it
can you write a tutorial to show how to create a file using php i want to be able to create a file and put some code in it [1264], Last Updated: Sat May 18, 2024
tuis
Thu Apr 09, 2009
2 Comments
307 Visits
can you write a tutorial to show how to create a file using php
i want to be able to create a file and put some code in it
can that be done? i know creating a file you have to use the fopen function but thats all i have learn so far so i want to know how i would go about making a file in using php scripts, can you send me the step by step instructions.
thanks
for example to add:
<?php
$handle = fopen("wallpapers.txt", "w");
?>
'r' Open for reading only; place the file pointer at the beginning of the file
.
'r+' Open for reading and writing; place the file pointer at the beginning of the file.
'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call.
'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call.