0
我想從另一個站點提取數據以根據該數據站點進行更新我的網站,但上面的錯誤代碼顯示,我的代碼如下: -調用第13行D: xampp htdocs simplehtmldom index.php中的非對象的成員函數find()
include('simplehtmldom/simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file("http://www.nepalstock.com/companydetail.php");
$table = $html->find('table[width="386"]');
$i = 0;
$data = array();
foreach ($table[0]->find('tr') as $tr) {<!--this is my line 13-->
$i++;
if ($i == 1 || $i == 2) continue;
$td = $tr->find('td');
array_push($data, array(
'listed_share' => trim($td[0]->plaintext),
'paid_up_value' => trim($td[1]->plaintext),
'total_paid_Up_Value' => trim($td[2]->plaintext),
'closing_market_price' => trim($td[3]->plaintext),
));
}
$html->clear();
unset($html);
if (empty($data)) exit('No data !!!');
print '<pre>';
print_r($data);
print '</pre>';
您在代碼中使用了三次find()函數。請你能告訴我在哪一行上給出的錯誤? – Iffi 2015-04-05 10:19:41
無論如何哪些內容是你的? – Ghost 2015-04-05 10:31:51
我會評論我的錯誤發生的地方。 – 2015-04-05 10:38:05