[請益] 裝dokuwiki出現錯誤preg_replace

看板PHP作者 (you got me)時間19年前 (2007/03/02 09:27), 編輯推噓0(005)
留言5則, 1人參與, 最新討論串1/1
Warning: preg_replace() [function.preg-replace]: Compilation failed: lookbehind assertion is not fixed length at offset 5 in /***/confutils.php on line 151 144 function confToHash($file,$lower=false) { 145 $conf = array(); 146 $lines = @file( $file ); 147 if ( !$lines ) return $conf; 148 149 foreach ( $lines as $line ) { 150 //ignore comments 151 $line = preg_replace('/(?<!&#.*$/','',$line); 152 $line = trim($line); 153 if(empty($line)) continue; 154 $line = preg_split('/\s+/',$line,2); 155 // Build the associative array 156 if($lower){ 157 $conf[strtolower($line[0])] = $line[1]; 158 }else{ 159 $conf[$line[0]] = $line[1]; 160 } 161 } 162 163 return $conf; 164 } 看不懂這個warning是什麼意思 而且對php不太熟悉^^"但會一些基本程式語言 照著dokuwiki的安裝說明跑 之前也有出現過這個問題 我把整個目錄砍掉 重新安裝,設定權限等等...就可以了 這次砍掉再重新安裝也沒用,一安裝完就出現錯誤訊息... 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.229.15.169 ※ 編輯: slasher 來自: 61.229.15.169 (03/02 09:41)

03/02 12:58, , 1F
把(改成\(試試 ()這兩字是括起一段供後面以\1等參考
03/02 12:58, 1F

03/02 12:59, , 2F
或是範圍指定
03/02 12:59, 2F

03/02 13:00, , 3F
不過像你這種情形 要的應該不只是這個
03/02 13:00, 3F

03/02 13:00, , 4F
看了一下 改用字元組會比較好: '/[(?<!&#.*$]/'
03/02 13:00, 4F

03/02 13:00, , 5F
當然這是不是原先dokuwiki就這樣寫就不知道了
03/02 13:00, 5F
文章代碼(AID): #15vts5zC (PHP)
文章代碼(AID): #15vts5zC (PHP)