Ich verwende html dom ParserHTML DOM Parser
i HTML-Code wie diese haben und wollen mit Klasse blau
<html>
<div id="rhy">
<h2 class="text">Text1</h2>
<ul class="blue">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<h2 class="text">Text2</h2>
<ul class="blue">
<li>4</li>
<li class="z">5</li>
<li>6</li>
</ul>
</div>
</html>
und ich habe alle LI von der ersten UL analysieren PHP-Code
$res = "";
foreach($html->find('#rhy -> .blue -> li[!class]') as $element)
{
$res = $res . $element;
}
echo $res;
dieser Code gibt
<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li>
, aber ich will
<li>1</li><li>2</li><li>3</li>
haben ich werde glücklich sein, wenn jemand weiß, wie mein Problem
Danke Mann! Es funktioniert – hivokas
@hivokas froh, Ihnen zu helfen –
markiert, danke! – hivokas