我有一些文本中有代碼。我想從鏈接中獲取最後一段文字。這裏是一個示例如何從簡單的html dom中的html標籤獲得渴望innertext
Some text<a href="http://beezfeed.cu.ma">Beezfeed.cu.ma</a><br>
another text<a href="http://google.com">Google.com</a><br>
我想從上面的代碼中獲取Google.com文本。我試過並使用簡單的html dom。無論如何這裏是我的代碼
<?PHP
require_once('simple_html_dom.php');
$html = new simple_html_dom();
function tags($ddd){
$bbb=$ddd->find('a',1);
foreach($bbb as $bs){
echo $bs->innertext;
}
}
$html = str_get_html('Some text<a href="http://beezfeed.cu.ma">Beezfeed.cu.ma</a><br>
another text<a href="http://google.com">Google.com</a><br>');
echo tags($html);
?>
我想獲得Google.com如何獲得。請幫我
可能的重複'':http:// stackoverflow.com/questions/29048706 /如何解壓縮文本之間錨定標籤在php中' –
我已經改變了一下代碼。看看 – Kumar