<?php
\t $file = 'C:\wamp\www\Killboard\EPChernarus1\PhitLog.txt';
\t $searchfor = 'Chernarus';
header('Content-Type: text/html');
$contents = file_get_contents($file);
\t $contents = str_replace("(ArmA-AH.net)", "(DayZNorway.com)", $contents);
$pattern = preg_quote($searchfor, '/');
\t $contents = str_replace("DayZ Instance: 11", " Map: Chernarus ", $contents);
$pattern = "/^.*$pattern.*$/m";
\t $contents = str_replace("PKILL", "Player Killed", $contents);
\t $contents = str_replace("CLOG", "Combat Logged", $contents);
if(preg_match_all($pattern, $contents, $matches)){
\t echo "<strong>";
echo "<div style ='font:11px/21px Arial,tahoma,sans-serif;color:#2983CB'>Killboard Epoch Chernarus: <br>";
\t echo '', implode(" <br>", $matches[0]);
\t echo "</strong>";
}
else
\t {
\t echo "No kills yet. Looks like everyone is playing nice.";
}
?>
在這裏有很大幫助後,代碼現在看起來這^ 現在我想包括下面的代碼。 因此它會將武器類重命名爲更友好的用戶名。 我已經包含了它尋找的兩個.php文件,但我不確定我放置它的位置,如果它甚至會像這樣運行,那麼我懷疑。
可能有人
\t \t if ($line_type == 'kill') {
\t \t \t include("killfeed_weapon_classnames.php");
\t \t \t include("killfeed_weapon_cleannames.php");
\t \t \t $swap_key = array_search($line_varlist['weapon'], $wcn);
\t \t \t if($swap_key != false) { $line_varlist['weapon'] = $wn[$swap_key]; }
\t \t }
旁註:我無法改變它登錄到PhitLog.txt文件的方式 – 2015-02-10 14:05:40
您是否嘗試過使用替換正則表達式? – 2015-02-10 14:11:34
'str_replace',簡單地說。 – ascx 2015-02-10 14:16:20