mobix Posted July 5, 2005 Report Posted July 5, 2005 man ir tads jautajums. Kaa var sataisit ta ka ja man ir txt fails kura jau ir ierakstitas vairakas rindas, pie katras no rindam var pievienot kadu text klat. Un to butu jaizdara skriptam ;) Nu ko ta darit? <_<
Delfins Posted July 5, 2005 Report Posted July 5, 2005 (edited) man ir tads jautajums.Kaa var sataisit ta ka ja man ir txt fails kura jau ir ierakstitas vairakas rindas, pie katras no rindam var pievienot kadu text klat. Un to butu jaizdara skriptam ;) Nu ko ta darit? <_< 19034[/snapback] ja fails nav liels, tad var ar file() rīkoties. $lines = file($filename); $cnt = count($lines); for ($i=0; $i<$cnt;$i++) { $lines[$i] .= 'somestuff'; } fwrite( fopen($filename,'w'), implode("\n",$lines) ); Edited July 5, 2005 by Delfins
bubu Posted July 5, 2005 Report Posted July 5, 2005 (edited) <?php $f = file('fails.txt'); for($i=0,$len=count($f);$i<$len;++$i) { $f[$i] = rtrim($f[$i])."kautkas"; } file_put_contents('fails.txt', implode("\n", $f)); ?> Delfins: file() atstāj beigu \n simbolu katrā elemntā Edited July 5, 2005 by bubu
mobix Posted July 5, 2005 Author Report Posted July 5, 2005 mja... nav viss ka nakas , neiet neiet sak mest lucus ta \n vieta un ta parmet uz otro rind .... nu koroch galiiga butra ;)
Recommended Posts