0

我有几行需要更改的 php 代码

while (eregi("([-]?)\"([^\"]+)\"", $a, $regs)) { 

while (preg_match("([-]?)\"([^\"]+)\"", $a, $regs)) {

if (strlen($word) < $min_word_length || (!eregi($pattern, remove_accents($word))) || ($common[$word] == 1)) {

if (strlen($word) < $min_word_length || (!preg_match($pattern, remove_accents($word))) || ($common[$word] == 1)) {

我尝试了所有可能的(我可以)组合,我在谷歌和这里也搜索过,但无法弄清楚。

4

1 回答 1

1

您没有使用分隔符....您可以查看手册php.net/manual/en/regexp.reference.delimiters.php

试试这个 "/([-]?)\"([^\"]+)\"/" (我只是在字符串 "/$pattern/" 的开头和结尾添加 "/" )

if (strlen($word) < $min_word_length || (!preg_match("/$pattern/", remove_accents($word))) || ($common[$word] == 1)) {
于 2011-08-05T00:04:21.857 回答