cherlick Posted May 29, 2008 Report Share Posted May 29, 2008 Boas Pessoal Eu gostaria de saber se me podem ajudar no seguinte: Eu tenho que modificar e eliminar texto. texto esse que esta inserido num ficheiro .txt só que nao sei muito bem como o fazer .Agradecia a voça ajuda abc. Link to comment Share on other sites More sharing options...
fnds Posted May 29, 2008 Report Share Posted May 29, 2008 Crias um formulário em que numa área de texto colocas o texto do ficheiro, depois envias o formulário e actualizas o ficheiro. Link to comment Share on other sites More sharing options...
cherlick Posted May 29, 2008 Author Report Share Posted May 29, 2008 Acho que percebi a tua ideia não tou e a ver como o posso fazer e que eu tenho um ficheiro prai com 25 linhas de texto e so quero mudar certas palavras ...e eu não sei como pegar nessas palavras que estao no texto e apagalas ou modificalas Link to comment Share on other sites More sharing options...
psiico Posted May 29, 2008 Report Share Posted May 29, 2008 carregas o ficheiro de texto para uma variavel e depois com o str_replace() substituis o q quiseres. Psiico // Portfolio Link to comment Share on other sites More sharing options...
cyclop Posted May 30, 2008 Report Share Posted May 30, 2008 file_put_contents e file_get_contents deve de chegar 😉 "Quando eu for grande quero ser como o Celso" Link to comment Share on other sites More sharing options...
cherlick Posted June 6, 2008 Author Report Share Posted June 6, 2008 Ja consegui com que identifica-se a palavra e a modifica-se so que agora tenho um problema e que se tiver mais alguma palavra igual ele tambem me muda essa e eu so quero que mude uma Abc Link to comment Share on other sites More sharing options...
cherlick Posted June 6, 2008 Author Report Share Posted June 6, 2008 for($j=0;$j<count($ler);$j++) { if($procura[$j]=="use") { if($_POST['use']!="") { $ler=(str_replace($procura[$j+1],$_POST['use'],$ler)); } } } aqui tem uma das partes do codigo que tenho andado a fazer so que la esta.. por exemplo tenho cher e cherlick no texto quero mudar cher para carro e isto esta me a fazer o seguinte: cher -> carro cherlick-> carrolick Se me poderem ajudar agradecia 😉 Link to comment Share on other sites More sharing options...
Gurzi Posted June 6, 2008 Report Share Posted June 6, 2008 for($j=0;$j<count($ler);$j++) { if($procura[$j]=="use") { if($_POST['use']!="") { $ler=(str_replace($procura[$j+1],$_POST['use'],$ler)); } } } aqui tem uma das partes do codigo que tenho andado a fazer so que la esta.. por exemplo tenho cher e cherlick no texto quero mudar cher para carro e isto esta me a fazer o seguinte: cher -> carro cherlick-> carrolick Se me poderem ajudar agradecia 😉 mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) Através do parâmetro $count, podes definir quantas vezes ele substitui. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now