当我第二次尝试将文件加载到 dom 对象中时(我之前将其清除),dom 变量为空 :( 如何在我的课程中使用 simple-html-dom 类两次?
<?php
require_once 'simple_html_dom.php';
class RO{
public $dom;
public $dom2;
public function __construct(){
$this->dom = new simple_html_dom();
$this->dom2 = new simple_html_dom();
}
function GetDatumInUroPodatkovInTabKrajev($lang){
$this->dom->load_file("http://www...diferentadresthenbelow...html");
$tabelaTempInKrajev = $this->dom->find('table[@class="online"]');
//some code...
//some code...
return $this->functon2("minkjaaa");
}
function functon2($ik){
$this->dom2->load_file("http://www.arso.gov.si/vreme/napovedi%20in%20podatki/vreme_si.html");
$tabelaVremRazm = $this->dom2->find('table[@class="online"]'); // this line trows an error, becaus dom2 is empty
return"";
}
}
?>
和 trowen 错误:
[Fatal error: Call to a member function find() on a non-object in C:\..\simple_html_dom.php on line ..]