Warning: preg_match

2019-09-02 23:56发布

问题:

Warning: preg_match() [function.preg-match]: Compilation failed: unmatched parentheses at offset 3 in /home/watchit/public_html/wp-includes/class-wp.php on line 201

for this:

if ( preg_match("#^$match#", $request_match, $matches) ||

changed to this:

if ( preg_match("#^$match#", $request_match, $matches)) ||

and got this:

Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/watchit/public_html/wp-includes/class-wp.php on line 201

回答1:

if ( preg_match("#^".preg_quote($match,'#'),"#", $request_match, $matches) ||

Note also I removed the extra ) before ||



回答2:

Your OR operator ( || ) needs to be part of the if clause, so

if ( preg_match("#^$match#", $request_match, $matches)) ||

Needs to become

if ( preg_match("#^$match#", $request_match, $matches) || your other conditions ){


标签: php wordpress