mobix Posted July 5, 2005 Report Share 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? <_< Link to comment Share on other sites More sharing options...
Delfins Posted July 5, 2005 Report Share 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 Link to comment Share on other sites More sharing options...
bubu Posted July 5, 2005 Report Share 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 Link to comment Share on other sites More sharing options...
mobix Posted July 5, 2005 Author Report Share 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 ;) Link to comment Share on other sites More sharing options...
Recommended Posts