0
我在這Statsoft site HTML文件中,特別是在這一部分:從具有其他孩子標籤中獲取文本
<p>
<a name="Z Distribution (Standard Normal)">
<font color="#000080" size="4">
Z Distribution (Standard Normal).
</font>
</a>
The Z distribution (or standard normal distribution) function is determined by the following formula:
</p>
我想要的文字The Z distribution (or standard normal distribution) function is determined by the following formula:
和我寫了一些代碼是這樣的:
include('simple_html_dom2.php');
$url = 'http://www.statsoft.com//textbook/statistics-glossary/z/?button=0#Z Distribution (Standard Normal)';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
$html = new simple_html_dom();
$html->load($curl_scraped_page);
foreach ($html->find('/p/a [size="4"]') as $e) {
echo $e->innertext . '<br>';
}
它只是給了我:Z Distribution (Standard Normal).
我試着寫
foreach ($html->find('/p/a [size="4"]/font') as $e) {
,但它給了我一個空白頁。
我錯過了什麼?謝謝。
它仍然無法正常工作,我該怎麼辦? – Fii
查找'/ p',即元素中,找到了''和刪除從'了' –
文字請你把這些代碼到我的代碼?我想我不知道如何把你的解決方案放到我的問題中。謝謝。 – Fii