Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] preg_replace
Lonas
post
Post #1





Grupa: Zarejestrowani
Postów: 576
Pomógł: 14
Dołączył: 9.11.2005

Ostrzeżenie: (20%)
X----


Hej jak za pomoca preg_replace zamienic to :


$skrot = preg_replace('<img src="../upload/galeria/min/>', '<img src="../upload/galeria/big/>', $skrot );


dziala mi tak :
$skrot = preg_replace('/(<a href=")([1-9]{1,}">)/', '\\1pokaz_art.php?id=\\2', $skrot );

nie wiem jak przerobic sobie to wyzej


--------------------
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
DarK MaN
post
Post #2





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 4.10.2004

Ostrzeżenie: (0%)
-----


Napisz troche jaśniej co w co chcesz zamienić.
Go to the top of the page
+Quote Post
Lonas
post
Post #3





Grupa: Zarejestrowani
Postów: 576
Pomógł: 14
Dołączył: 9.11.2005

Ostrzeżenie: (20%)
X----


/upload/galeria/min/ na <img src="../upload/galeria/big/


--------------------
Go to the top of the page
+Quote Post
Amorph
post
Post #4





Grupa: Zarejestrowani
Postów: 309
Pomógł: 0
Dołączył: 6.06.2006
Skąd: include('root/europe/ poland/szczecin.php');

Ostrzeżenie: (0%)
-----


<?php
$string = ' cos <img src="../upload/galeria/min/"> coscoscoscoscoscos';
$replace = str_replace( '<img src="../upload/galeria/min/">', '<img src="../upload/galeria/big/">', $string );
echo $replace;
?>
powinno zadziałać...
Go to the top of the page
+Quote Post
Lonas
post
Post #5





Grupa: Zarejestrowani
Postów: 576
Pomógł: 14
Dołączył: 9.11.2005

Ostrzeżenie: (20%)
X----


Nie dziala


--------------------
Go to the top of the page
+Quote Post
DarK MaN
post
Post #6





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 4.10.2004

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $string = ' cos <img src="../upload/galeria/min/"> coscoscoscoscoscos';
  3. $replace = str_replace( '<img src="../upload/galeria/min/">', '<img src="../upload/galeria/big/">', $string );
  4. echo $replace;
  5. ?>


to działa tylko że zamienia tylko stringi <img src="../upload/galeria/min/"> a chyba chodzi o podmianę każdego linku z frazą ../upload/galeria/min/ a nie z <img src="../upload/galeria/min/"> więc propoonuje zmienicna
  1. <?php
  2. $string = ' cos <img src="../upload/galeria/min/"> jakis html dalej i inne rysunki';
  3. $replace = str_replace( 'src="../upload/galeria/min', 'src="../upload/galeria/big>', $string );
  4. echo $replace;
  5. ?>
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 17:38