我试图从文件读取此:正则表达式在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