![](/img/trans.png)
[英]Issue with preg_match_all : Compilation failed unmatched parentheses
[英]Preg_Match_All : Compilation failed
我已經將一個站點遷移到一個新服務器,我確保PHP版本是相同的(5.3)以及擴展。
我有一個問題是preg_match_all。 我得到的錯誤是:
preg_match_all()[function.preg-match-all]:編譯失敗:(?R或(?[+ - ]位必須跟着)在偏移22處
這一行是:
if (preg_match_all('/([^{]++)({([^{}]++|(?R2))*})/', $code, $items, PREG_SET_ORDER)) { // split declarations
這是一個沒有支持的隨機插件,但只是想知道它是否真的丟失了a)。
出於某種原因,此代碼仍在原始服務器上運行。
最好放一個你試圖在其上運行函數的字符串樣本。
但是,錯誤是因為'?' 是正則表達式中的運算符。 你應該逃避它。 用反斜杠
if (preg_match_all('/([^{]++)({([^{}]++|(\?R2))*})/', $code, $items, PREG_SET_ORDER)) { // split declarations
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.