Vecteevs Posted October 25, 2011 Report Share Posted October 25, 2011 (edited) Man ir jautājums, kā izvlikt saturu no kā tāda? <span class="black">Name:</span> Aivars <br /> Izvilkt vajag tieši vārdu/s kur ir "Aivars", bet tas var arī būt jebkāds vārds. Kā tad izvilkt, ja tas vārds nav nekādos tagos? To kas ir iekš span es izvelku šādi $pattern = '/<span class\=\"black\">(.*?)<\/span>/i'; Edited October 25, 2011 by Vecteevs Quote Link to comment Share on other sites More sharing options...
briedis Posted October 25, 2011 Report Share Posted October 25, 2011 (edited) Bez regulārām izteiksmēm variants: list(,$vards) = explode(" ", strip_tags($html)); echo $vards; Bet šis nedarbosies, ja būs vārds ar atstarpēm :) Edited October 25, 2011 by briedis Quote Link to comment Share on other sites More sharing options...
daGrevis Posted October 25, 2011 Report Share Posted October 25, 2011 HTML is **NOT** regular. Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted October 26, 2011 Author Report Share Posted October 26, 2011 man tur ir teikums, to vārdu es kā piemēru.. Quote Link to comment Share on other sites More sharing options...
Kavacky Posted October 26, 2011 Report Share Posted October 26, 2011 HTML is **NOT** regular. Regulāra ir izteiksme, pēc kuras meklē, nevis teksts. Quote Link to comment Share on other sites More sharing options...
indoom Posted October 26, 2011 Report Share Posted October 26, 2011 $str = '<span class="black">Name:</span> Aivars ir garš teikums <br />'; list(,$teikums) = explode('</span>', $str, 2); var_dump(trim($teikums)); Quote Link to comment Share on other sites More sharing options...
daGrevis Posted October 26, 2011 Report Share Posted October 26, 2011 Atbilde #1. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.