那么这是html代码:
<?
$html ='<table cellspacing="0" cellpadding="0" class="mytable">
<tr>
<th class="first-td">Home <span>Live</span></th>
<th>type</th>
<th>Status</th>
</tr>
<tr>
<td width="40%" class="first-td">text1</td>
<td>info</td>
<td class="status"><span class="identify">asdf2</span></td>
</tr>
<tr>
<td width="40%" class="first-td">text2</td>
<td>info</td>
<td class="status"><span class="identify2">asdf</span></td>
';
$pattern = '/<span class="identify">(.*?)<\/span>/im';
preg_match_all($pattern, $html, $matches);
print_r($matches);
?>
但我想要的是取回单词 text,这是标识类的单元格中的 td。或者,如果类是识别打印 1 或者如果是识别 2 按 0,则可能更容易。
所以我想要这样的伪代码:
If class-identify print the td-class=first-td of that cell