這給了我一個像「注意:未定義的偏移量:0在第12行\ index.php中」的錯誤。preg_match:undefined偏移
$arr = array('a', 'b', 'c', 'd');
$i=0;
while($i<=3){
foreach($arr as $value){
//get data
$content = file_get_contents('http://www.example.com/$value');
preg_match("^ y: ....^", $content, $match);
$string = $match[$i];
$i++;
echo $value;
echo $string;
}
}
'$ match'不工作,你正在使用它的方式 - 它包含的子模式匹配。我建議你在修改代碼前仔細閱讀[PCRE文檔](http://www.php.net/manual/en/book.pcre.php)。 – cmbuckley 2011-12-30 02:23:52
你不需要while循環 – 2011-12-30 02:25:38