我的问题如下:我正在解析或抓取或类似字典以将其输出用作我的输入(换句话说,我显示了定义)。在这个输出中,包括了几个类。有一个类,即 f 类,它包括定义的术语,以及它后面的一个点。这个点打扰了我,我想把它擦掉。
<p class="p">
<a href="search?id=D536ScxxE2x5wsXG0ez" target="_self"><img align="right" alt="Ver artículo enmendado" border="0" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAAZBAMAAADuyzxaAAAAElBMVEWEAgT8/vz8QkT8AgS8AgT8enxcJRi+AAAA0klEQVQ4y82SwQ3DMAhFOWQBxAJVqwyAWCCHjJDuv0r5OImR2hxqLkEWXxAeBis0vyu20LOCb85XBlidLwywBT8+wBr8y0btNrweGWmifIWwdN/5vVzOPpe8SveJl3z737x6zMJuoq7CzqOlQlhZkRGoQqz5xBty3sULw1kgFoAHbpFEs34S70UeN9QSz2ez6NOwb17sgu8Bypsq/+CB7nyevwf+zfLwmde2ItZgjbGx6fl+sbzE+2GN49zp/y3xNGwT+Mc4T+ALOE0LVa4nWqhoH2NuCULPEni8AAAAAElFTkSuQmCC"></a>
<span class="f">
<b>gas</b>
</span>
<span class="f">
<b>.</b>
</span>
</p>
请注意,我正在彻底使用 php,所以如果你需要它,这里是:
<?php
$word = $_REQUEST['word'];
$url = "http://lema.rae.es/drae/srv/search?val={$word}";
$css = <<<EOT
<style type="text/css">
.f /* I GUESS THE PROBLEM IS OVER HERE. I CANT VISIBILITY HIDE F BECAUSE THAT WOULD HIDE "GAS", APART FROM "." */
{
margin-left:50px;
font-size: 200%;
color: #ffe200;
font-family: 'brannboll_fetregular';
}
</style>
EOT;
$data = file_get_contents($url);
$data = str_replace('</head>', $css.'</head>', $data);
echo '<div id="result1"
style="
top: 77%;
left: 55%;
overflow:scroll;
width:400px;
height:300px;
border: 1px solid #000000;
border-radius: 15px;
background-opacity: 0.5;
background: #047C8F;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
box-shadow: inset 0px 3px 13px #000000;
-moz-box-shadow:
0px 3px 13px rgba(000,000,000,0.5),
inset 0px 0px 13px rgba(0,0,0,1);
-webkit-box-shadow:
0px 3px 13px rgba(000,000,000,0.5),
inset 0px 0px 13px rgba(0,0,0,1);
">
'.$data.'
</div>';
?>