Warning: preg_match

2019-09-03 00:12发布

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

标签: php wordpress
2条回答
孤傲高冷的网名
2楼-- · 2019-09-03 00:27

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 ){
查看更多
叛逆
3楼-- · 2019-09-03 00:30
if ( preg_match("#^".preg_quote($match,'#'),"#", $request_match, $matches) ||

Note also I removed the extra ) before ||

查看更多
登录 后发表回答