...中的未知修饰符"/"?它是什么? [英] Unknown modifier '/' in ...? what is it?

查看:151
本文介绍了...中的未知修饰符"/"?它是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我写以下内容时,我得到这样的警告,它与任何内容都不匹配,但是我敢肯定,$row_search['content']包含$value ...

When i wrote the following, i get such warning, and it doesn't match anything, but i'm sure, that $row_search['content'] contains $value...

preg_match_all("/[^\s]*".preg_quote($value)."[^\s]*/iu", $row_search['content'], $final_matched);

WARNING:preg_match_all() [function.preg-match-all]: Unknown modifier '/' in C:\xampp\htdocs\finance\search\search.php on line 82

为什么我会收到这样的警告消息?

why i get such warning message?

谢谢

推荐答案

我假定$value包含斜杠/

I assume $value contains a slash /, which is not escaped by preg_quote:

特殊的正则表达式字符为:. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -

将您使用的定界符传递给函数:

Pass the delimiter you use to the function:

preg_match_all("/[^\s]*".preg_quote($value, '/')."[^\s]*/iu", $row_search['content'], $final_matched);
//                                        ---^

或使用另一个定界符.

这篇关于...中的未知修饰符"/"?它是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆