©
This document uses PHP Chinese website manual Release
这些函数的行为受 php.ini 中的设置影响。
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
pcre.backtrack_limit | "100000" | PHP_INI_ALL | php 5.2.0可用. |
pcre.recursion_limit | "100000" | PHP_INI_ALL | php 5.2.0可用. |
这是配置指令的简短说明。
pcre.backtrack_limit
integer PCRE的回溯限制.
pcre.recursion_limit
integer PCRE的递归限制. 请注意, 如果 讲这个值设置为一个很大的数字, 你可能会消耗掉 所有的进程可用堆栈, 最终导致php崩溃(直到达到系统限制的堆栈大小).
[#1] php at richardneill dot org [2011-01-14 09:55:00]
pcre.backtrack_limit defaults to 100k. This is rather conservative.
It is limited by RAM size, not the ulimit on stack-size.
On a (2009-era) netbook, I can set pcre.backtrack_limit to 100 million, and the regex will happily process a 90 million character string in about 3 seconds. YMMV.
[#2] chris at ocproducts dot com [2010-07-02 07:42:48]
pcre.backtrack_limit sets the maximum bind length PREG calls (e.g. preg_replace_callback) can make. However the actual maximum seems to be approximately half the value set here, possibly due to the character encoding that PCRE runs with internally.