脚本:foreach数组?
include_once 'simple_html_dom.php';
$ckfile = 'cookie.txt';
foreach (range('a', 'z') as $letters) {
echo $letters;
}
foreach (range('1', '100') as $numbers) {
echo $numbers;
}
$ch = curl_init ("http://site/test.php?letter=".$letters."&page=".$numbers."");
curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$output = curl_exec ($ch);
$html = str_get_html(''.$output.'');
foreach($html->find('a') as $element) {
echo $element->href . '<br>';
}
正如你可以看到有三个数组分隔,一个接一个的作品,但他们如何“放在一起”中的一个的foreach做“工作”?
等。我不熟悉的foreach毕竟,如果我没记错的话,这是我第二次与“他们” ......
它的工作原理,谢谢,它比我预期的更简单... – ZeroSuf3r 2012-03-09 11:20:18