安裝

The PCRE extension is a core PHP extension, so it is always enabled. By default, this extension is compiled using the bundled PCRE library. Alternatively, an external PCRE library can be used by passing in the --with-pcre-regex=DIR configuration option where DIR is the location of PCRE's include and library files.

PHP 的 Windows 版本已經內置該擴充功能的支援。無需載入任何附加擴充功能即可使用這些函式。

Note:

Before PHP 5.3.0, this extension could be disabled by passing in the --without-pcre-regex configuration option.

PCRE is an active project and as it changes so does the PHP functionality that relies upon it. It is possible that certain parts of the PHP documentation is outdated, in that it may not cover the newest features that PCRE provides. For a list of changes, see the » PCRE library changelog and also the following bundled PCRE history:

Upgrade history of the bundled PCRE library
PHP 版本 Updated PCRE 版本 Notes
5.5.10 8.34  
5.5.0 / 5.4.14 / 5.3.24 8.32  
5.4.9 / 5.3.19 8.31  
5.3.7 8.12  
5.3.6 8.11  
5.3.4 8.10  
5.3.3 8.02  
5.3.2 8.00  
5.3.0 7.9  
5.2.7 7.8  
5.2.6 7.6  
5.2.5 7.3  
5.2.4 7.2  
5.2.2 7.0  
5.2.0 6.7  
5.1.0 6.2  
5.0.5 5.0  
5.0.0 4.5  
4.4.7 7.7  

add a note add a note

User Contributed Notes 1 note

up
0
Lrinczy Zsigmond
5 years ago
From PHP version 7.3, 'pcre2' is used instead of 'pcre'. It is bundled with the PHP source, or a preinstalled pcre2 can be used if it was compiled with these configure-options:

--enable-shared --enable-unicode --enable-jit

If you want to use preinstalled pcre2 with PHP, use configure-options --with-pcre-dir=<path> and --with-pcre-regex=<path> (I don't know why there is two of them).
To Top