PHPアプリケーションで、プロダクションサーバーで使用しようとするとnullを返すコードがいくつかありますが、開発サーバーで正常に動作します。コード行は次のとおりです。preg_match_all `u`フラグは何に依存していますか?
// use the regex unicode support to separate the UTF-8 characters into an array
preg_match_all('/./us', $str, $match);
u
のフラグは何ですか?私はmb_string
を有効にして無効にしてテストしましたが、影響を与えていないようです。
私は取得していますエラーがある
preg_match_all: Compilation failed: unknown option bit(s) set at offset -1
詳細
これはprodctionサーバー上の選択肢の一つである:ここ
'--with-pcre-regex=/opt/pcre'
とpcreセクションです
Picture.png http://img829.imageshack.us/img829/8524/pictureke.png
私は、これは@Wesleyが参照されたノートであると考えている:
In order process UTF-8 strings, you must build PCRE to include UTF-8
support in the code, and, in addition, you must call pcre_compile()
with the PCRE_UTF8 option flag, or the pattern must start with the
sequence (*UTF8). When either of these is the case, both the pattern
and any subject strings that are matched against it are treated as
UTF-8 strings instead of strings of 1-byte characters.
"UTF-8が含まれるようにPCREを構築" する方法上の任意のリンクやヒントを?これは、PCREに依存pcretest -C
PCRE version 6.6 06-Feb-2006
Compiled with
UTF-8 support
Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
変数または定数に対してテストしていますか?あなたの例は変数を持っています、私はあなたがdevとliveで同じことをしていることを保証するために定数に対してテストするべきだと思います。 – hakre
http://php.net/manual/en/reference.pcre.pattern.modifiers.phpもコメントを参照してください。 –