Expand|Select|Wrap|Line Numbers
- $file = "data.txt";
- $fp = fopen($file,"w+");
- $line = fgets($fp,"120"); // i need only 1st line to read and upto 120 bytes
- echo $line;
- fclose($fp);
use " w+ " for read the data in file and then overwrite the new data.
but it is not read the date in file already , while open the file it delete the data in file and then write to it.
so for read data i had used to open file two times first to read and then with w+ for over write...
>>and other is "r+" file modifier mention in php read and write, it does but it append the new data to file , which i do not need i need read the data from file and overwrite the new data to file...but w+ is also not worked..
Please tell the soluion how to solve this..
Thanks