View Full Version : simple php question
xiaodao
04-16-2005, 02:31 PM
how to write to a text file every time one line in php
Tangerine Dream
04-16-2005, 02:39 PM
Hi, check fwrite (http://www.php.net/manual/en/function.fwrite.php) function for example
xiaodao
04-16-2005, 02:44 PM
hi, thanks for replying, i do know how to use fwrite but i want one line each time, i put "\n" to the end of my string,but still not one linke every time
Tangerine Dream
04-16-2005, 02:57 PM
So you should say what you have (array containing strings?) and what you need (output one element from array to text file?), and post PHP code for your array
xiaodao
04-16-2005, 03:08 PM
$filepath=$path.$month."/".$day.".dat";
$fp=fopen($filepath,"a+");
$from=checkip($onlineip);
$string="\n".$onlineip."|".$from;
fwrite($fp,$string);
fclose($fp);
i want each time i write to the file, it start at a new line
Scrowler
04-17-2005, 09:47 AM
did you chmod the file?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.