我不明白有什么问题,我怎么能对这个简单的正则表达式有这个错误。 我可以输入任何我想要的东西,它总会给我同样的错误。在消息本身中,它没有显示哪个修饰符导致问题,修饰符只是空的。
public function getRows($content) {
$regex = '/[a-z]+/';
preg_match($content, $regex, $rows);
print_r($rows); exit;
return $return;
}
答案 0 :(得分:3)
第一个参数是正则表达式,第二个是主题:
来自preg_match() in the Manual 的int preg_match(string $ pattern,string $ subject ...
所以这应该可以正常工作:preg_match($regex, $content, $rows);