Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]preg_match_all
super1254
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 27.09.2006

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


Witam

Mam problem

Mam taki kod:
  1. <?php
  2. preg_match_all('[<span class="postbody">(.+?)</span></td>]is',$strona,$categoria);
  3. $tekst=strip_tags($categoria[0][0]);
  4. ?>


Wszystko działa dobrze tylko w tym problem że chce by wyświetliło/zapisało wszystkie treści z <span class="postbody">(.+?)<\/span><\/td> (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Po prostu kod z którego pobieram wygląda tak: - jest to tylko schemat (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)

  1. <span class="postbody">Treść</span></td>
  2. a
  3. <span class="postbody">Treść2</span></td>
  4. sdsadsadsa
  5. <span class="postbody">Treść3</span></td>
  6. dfeqwwqewq


Już z góry zaznaczam że proszę o jak najprostsze rozwiązanie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
diox
post
Post #2





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 8.09.2007

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


  1. preg_match('/\<div style\=\"z\-index\: 1000\;\" class\=\"avatars last_guests\"\>(.*?)\<div class\=\"clear\"\>\<\!\-\- \. \-\-\>\<\/div\>\<\/div\>/ism',$site,$out);
  2.  
  3.  
  4.  
  5. foreach($out as $k)
  6. {
  7. echo $k."<br />";
  8. }


niestety w dalszym ciągu nie wyświetla nic , co prawda w moim przykładzie zaponiałem o " last_guests" ale nie ważne czy jest napiane " last_guests" czy " last\_guests" dalej wyświetlane jest -- nic
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 11.10.2025 - 03:28