0
我是Vtiger CRM的新手。我想在log4php.properties文件中編寫php代碼,並且它也需要執行。Vtiger CRM#:如何在log4php.properties文件中編寫PHP代碼
我可以編寫代碼,但它根本沒有執行。所以,請以一種可以執行文件的方式幫助我。
此外,這需要動態執行與單獨的域。
感謝
我是Vtiger CRM的新手。我想在log4php.properties文件中編寫php代碼,並且它也需要執行。Vtiger CRM#:如何在log4php.properties文件中編寫PHP代碼
我可以編寫代碼,但它根本沒有執行。所以,請以一種可以執行文件的方式幫助我。
此外,這需要動態執行與單獨的域。
感謝
打開從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);
}
非常感謝你的幫助。真棒的人。 –