php_Stopp Posted September 30, 2005 Report Share Posted September 30, 2005 nu man buutu taads jaut - kaa es varu no txt documenta izdzeest line breaku ? opt man ir txt fails, kura informaacija ir: rinda1 rinda2 rinda3 rinda4 un es gribeetu izdzeest opt "rinda2\n" (nu vaardu sakot rindu un to line break, kas aiz taas seko, lai failaa nepaliktu tuksa rinda). paldies par atbildeem Link to comment Share on other sites More sharing options...
bubu Posted September 30, 2005 Report Share Posted September 30, 2005 http://php.lv/f/index.php?showtopic=2935 (rindas dzēšana no faila) Link to comment Share on other sites More sharing options...
nemec Posted September 30, 2005 Report Share Posted September 30, 2005 trim() Link to comment Share on other sites More sharing options...
bubu Posted September 30, 2005 Report Share Posted September 30, 2005 Un kādā rakā trim() izdzēsīs faila rindu, nemec? Link to comment Share on other sites More sharing options...
php_Stopp Posted October 1, 2005 Author Report Share Posted October 1, 2005 vai nu nejeedzu izmantot arii taada veida searchu, vai arii nekur nebija man vajadziigaas informaacijas.. pienemsim, ka txt fails izskataas saadi: jaanis peeteris pasaule aaksts maita nu man vajadzeetu izdzeest rindinu 'peeteris' un tam sekojoso line break, bet es nezinu, kura rindina taa ir. kaads vareetu paliidzeet ? Link to comment Share on other sites More sharing options...
ohmygod Posted October 1, 2005 Report Share Posted October 1, 2005 (edited) $a=file('text.txt'); print_r($a); Reku tev masīvs ar faila saturu - katrs masīva elements - viena rindiņa. Paņem masīva elementa numuru +1 un būs tev rindas numurs! Tālāk jau nāk darbības ar masīviem... http://lv2.php.net/manual/ru/ref.array.php Edited October 1, 2005 by ohmygod Link to comment Share on other sites More sharing options...
php_Stopp Posted October 1, 2005 Author Report Share Posted October 1, 2005 nea, man jau to numuru nevajag uzzinaat ;) man vajag, lai izdzeesas taa rindina ar attieciigu saturu, sai gadiijumaa 'peeteris'. es meeginaaju panemt visu faila saturu kaa mainiigo un tad ar str_replace attieciigo rindinu paarveidot par tuksumu, bet tad failaa paliek tuksa rinda. kaa var to tuko rindu dabuut aaraa ?? Link to comment Share on other sites More sharing options...
nemec Posted October 1, 2005 Report Share Posted October 1, 2005 nu pardon par trim(), es domaaju vinjsh deesh \n. bet tev vienkārši jāņem visi dati ārā piemēram ar file(), tad no masīvā jāizdzēš un jāsaglabā atpakaļ tajā failā. Ja jau tādus pribombasus tev vajag, tad labāk izmanto mysql, mazāk čakara būs... Link to comment Share on other sites More sharing options...
blackhalt Posted October 1, 2005 Report Share Posted October 1, 2005 (edited) ~~ <?php $kodzest='Jaanis'; $a=file_get_contents($file); //if(ereg($kodzest,$a)){ $a=preg_replace("/(.)+$kodzest+\n/",'',$a); $f=fopen($file,'w+'); fwrite($f,$a); fclose($f); //} ?> Edited October 1, 2005 by blackhalt Link to comment Share on other sites More sharing options...
nemec Posted October 1, 2005 Report Share Posted October 1, 2005 tavs variants vinjam visus resursus apeedis Link to comment Share on other sites More sharing options...
blackhalt Posted October 1, 2005 Report Share Posted October 1, 2005 tavs variants vinjam visus resursus apeedis 23609[/snapback] Izmērīji? Link to comment Share on other sites More sharing options...
Recommended Posts