1 頁 (共 1 頁)

PHP 5.5 Replace deprecated preg_replace /e with preg_replace

發表於 : 2015-08-24 22:34:22
yehlu

代碼: 選擇全部

    //$file_content = preg_replace("/\\{res:\s*CCS_FormatInfo\\}/ise", "CCConvertEncoding(\$CCSLocales->GetText('CCS_FormatInfo'), \$FileEncoding, \$this->internal_encoding)", $file_content);
    $file_content = preg_replace_callback("/\\{res:\s*CCS_FormatInfo\\}/is",function($m){ return "CCConvertEncoding(\$CCSLocales->GetText('CCS_FormatInfo'), \$FileEncoding, \$this->internal_encoding)";}, $file_content);

    //$file_content = preg_replace("/\\{res:\s*(\w+)\\}/is", "\$CCSLocales->GetText('\\1')", $file_content);
    $file_content = preg_replace_callback("/\\{res:\s*(\w+)\\}/is",function($m){ global $CCSLocales; return $CCSLocales->GetText($m[1]);}, $file_content);