Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Problem z preg_replace
--shaman--
post
Post #1





Goście







Mam problem z preg replace. Chcę wyciąć linki do jednej strony, ale mi to nie wychodzi. Nie wiem jak wyciąć
  1. http://www.
i to co jest po slashu
  1. /something-after-ending-slash


Mój kod:

  1. <?php
  2. $text = preg_replace("'(example.com)'i", '', $text);
  3. ?>


a taki jest efekt

Załóżmy, że ktoś wkleił linka:

  1. http://www.example.com/something-after-ending-slash


A taki jest efekt:

  1. http://www. /something-after-ending-slash
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: 19.08.2025 - 21:45