开发者

Warning: preg_match() [function.preg-match]: Unknown modifier 'v'

开发者 https://www.devze.com 2023-02-17 06:17 出处:网络
I keep getting this error about 20 times in my wordpress blog about the same line of code. Here is开发者_C百科 the line of code that keeps getting the error.

I keep getting this error about 20 times in my wordpress blog about the same line of code. Here is开发者_C百科 the line of code that keeps getting the error.

if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) )
        $number = max($number, $matches[1]);

What could be wrong?


Your regex will break if the string $id_base has a / in it as you are using / as the regex delimiter.

To fix this use preg_quote on $id_base as:

if (preg_match('/'. preg_quote($id_base,'/').'-([0-9]+)$/', .....) {
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号