|
主要是為了修正phpbb2轉移discuz,造成某些代碼無法在discuz辨識的修正程式,主要是移除代碼後出現的不正常文數字(ex: [img:EB5BG557] ---> [img])
一個不小心,啃完php就把這程式寫出來
-
- <?php
- echo "開始轉換";
- $filename = "file_name.sql"; //原始檔案名稱
- $fd = fopen( $filename, "r" );
- $newname = "newsql2.sql"; //輸出檔案名稱
- $fnew = fopen($newname,"w+");
- $contents = fread($fd, filesize($filename));
-
- $contents=ereg_replace("img:[a-z0-9]+", "img", $contents);
- echo "文字修正中..........";
- $contents=ereg_replace("quote:[a-z0-9]+", "quote" , $contents);
- $contents=ereg_replace("code:[a-z0-9]+", "code" , $contents);
- $contents=ereg_replace("color:[a-z0-9]+", "color" , $contents);//取代用~
- fwrite($fnew,$contents);
- fclose( $fd );
- fclose( $fnew);
- echo "轉換完成!!!";
- ?>
複製代碼 |
|