cherlick Posted May 29, 2008 at 03:08 PM Report Share #188343 Posted May 29, 2008 at 03:08 PM 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 at 03:11 PM Report Share #188345 Posted May 29, 2008 at 03:11 PM 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 at 03:37 PM Author Report Share #188353 Posted May 29, 2008 at 03:37 PM 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 at 07:55 PM Report Share #188427 Posted May 29, 2008 at 07:55 PM 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 at 01:37 AM Report Share #188507 Posted May 30, 2008 at 01:37 AM 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 at 03:19 PM Author Report Share #189791 Posted June 6, 2008 at 03:19 PM 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 at 03:31 PM Author Report Share #189793 Posted June 6, 2008 at 03:31 PM 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 at 10:47 PM Report Share #189890 Posted June 6, 2008 at 10:47 PM 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