0
我想我不明白。我試着解析某些HTML頁面:使用simple_html_dom類,實際上明文函數返回的是什麼?
<select name="sel">
<option value="val0">-please select me-</option>
<option value="val1">some selection</option>
</select>
IM的Simple_html_dom類:
foreach($html->find('select') as $s) {
if ($html->find('option',1) != false) {
$tempoption = $html->find('option',1)->plaintext;
echo $tempoption; //shows 'some selection'
}
}
但是,這時如果我只是用這個行:
$value='';
if ($tempoption == 'some selection')
$value='79';
echo $value; //doesn't shows anything (empty variable?)
//or this one :
if (strcmp($tempoption, 'some selection'))
$value='79';
echo $value; //Nope.