我試圖從文件讀取此:正則表達式在PHP失敗
BEGIN_SEREFERRALS 2 google 13 15 search 2 2 END_SEREFERRALS
我用這個函數:
function getTextBetweenSEO($file)
{
$pattern = "/BEGIN_SEREFERRALS\s(.*)\sEND_SEREFERRALS/i";
preg_match_all($pattern, $file, $matches);
print_r($matches);
exit();
return $matches[1];
}
我所印的是:
Array ([0] => Array () [1] => Array ())
爲什麼正則表達式失敗
必須是別的東西,因爲你有什麼[只是作品(http://codepad.viper-7.com/eRUi2n) – PeeHaa
這是對我很好! – undone