//The code
foreach($odkazy as $odkaz) {
//Here i am loading each page
$html = new simple_html_dom();
$html->load_file($odkaz);
//Finding code of prodcut
$ptyp = $html->find("span.p-type");
foreach($ptyp as $a)
$item["p-type"] = trim($a->plaintext);
//Here are values of product
$hodnoticky = $html->find("dd");
foreach($hodnoticky as $h)
$hodnota[] = preg_replace('/\s\s+/', ' ',$h->plaintext);
//Here are parameters
$parametrici = $html->find("dt");
foreach($parametrici as $p)
$parametr[] = preg_replace('/\s\s+/', ' ',$p->plaintext);
//Here i am mixing them.
foreach($parametr as $i => $key)
$item[trim($key)] = $hodnota[$i];
$items[] = $item;
$html->clear();
unset($html);
}
print_r($items);
答案 0 :(得分:0)
似乎在循环之间永远不会取消设置项目数组。试试这个:
get
答案 1 :(得分:0)
哦。谢谢@JacobW。问题出在另一个数组中..我试图取消设置$ item ..但解决方案是取消设置带有值和参数的数组。谢谢!
$items[] = $item;
$html->clear();
unset($parametr);
unset($hodnota);
unset($item);
unset($html);