2017-02-23 49 views

回答

0

打開從CRM根目錄下的index.php文件,並添加以下代碼

function replace_string_in_a_file($filepath, $search, $replace) { 
    if (@file_exists($filepath)) { 

     $file = file($filepath); 
     foreach ($file as $index => $string) { 
      if (strpos($string, $search) !== FALSE) 
       $file[$index] = "$replace\n"; 
     } 
     $content = implode($file); 
     return $content; 
    }else { 
     return NULL; 
    } 
} 
$filepath = $root_directory . 'log4php.properties'; 
$search = 'log4php.appender.A1.File='; 
$replace = 'log4php.appender.A1.File=' . DOMAIN_PATH . '/logs/vtigercrm.log'; 
$log_properties_content = replace_string_in_a_file($filepath, $search, $replace); 

if (!empty($log_properties_content)) { 
    file_put_contents($filepath, $log_properties_content); 
} 
+0

非常感謝你的幫助。真棒的人。 –