替换输出中的单词.php



<?php
	$file = 'C:wampwwwKillboardEPChernarus1PhitLog.txt';
	$searchfor = 'Chernarus';
    header('Content-Type: text/html');
    $contents = file_get_contents($file);
	$contents = str_replace("(ArmA-AH.net)", "(DayZNorway.com)", $contents);
    $pattern = preg_quote($searchfor, '/');
	$contents = str_replace("DayZ Instance: 11", " Map: Chernarus ", $contents);
    $pattern = "/^.*$pattern.*$/m";
	$contents = str_replace("PKILL", "Player Killed", $contents);
	$contents = str_replace("CLOG", "Combat Logged", $contents);
if(preg_match_all($pattern, $contents, $matches)){
	echo "<strong>";
    echo "<div style ='font:11px/21px Arial,tahoma,sans-serif;color:#2983CB'>Killboard Epoch Chernarus: <br>";
	echo '', implode(" <br>", $matches[0]);
	echo "</strong>";
    }
else 
	{
	echo "No kills yet. Looks like everyone is playing nice.";
    }
 ?>

经过这里的大量帮助,代码现在看起来如下^现在我正在尝试包含下面的代码。因此,它将把武器类重命名为更便于用户使用的名称。我已经包含了它想要的两个.php文件,但我不确定我把它放在哪里,也不确定它是否会像现在这样运行,我对此表示怀疑。

有人会吗

		if ($line_type == 'kill') {
			include("killfeed_weapon_classnames.php");
			include("killfeed_weapon_cleannames.php");
			$swap_key = array_search($line_varlist['weapon'], $wcn);
			if($swap_key != false) { $line_varlist['weapon'] = $wn[$swap_key]; }
		}

在所有preg匹配之前和$contents之后使用:

$contents = str_replace("(Arma-AH.net)", "(DayZNorway.com)", $contents);

伊迪丝忘记了括号和下一个问题。我不打算只给你下一部分,但看看下面的例子,并遵循它,这将帮助你实现下一个问题的目标。

$myArray = array("firstName" =>"sam", "secondName" => "billy", "thirdName" => "sally");

$nameKey = array_search("billy", $myArray);
echo $nameKey;
if($nameKey){
    $myArray[$nameKey] = "Tom";
}
print_r($myArray);
<?php
    $file = 'C:wampwwwKillboardEPChernarus1PhitLog.txt';
    $searchfor = 'Chernarus';
    header('Content-Type: text/html');
    $contents = file_get_contents($file);
    $contents = str_replace("(ArmA-AH.net)", "(DayZNorway.com)", $contents);
    $pattern = preg_quote($searchfor, '/');
    $contents = str_replace("DayZ Instance: 11", " Map: Chernarus ", $contents);
    $pattern = "/^.*$pattern.*$/m";
    $contents = str_replace("PKILL", "Player Killed", $contents);
    $contents = str_replace("CLOG", "Combat Logged", $contents);
if(preg_match_all($pattern, $contents, $matches)){
    echo "<strong>";
    echo "<div style ='font:11px/21px Arial,tahoma,sans-serif;color:#2983CB'>Killboard Epoch Chernarus: <br>";
    echo '', implode(" <br>", $matches[0]);
    echo "</strong>";
    }
else 
    {
    echo "No kills yet. Looks like everyone is playing nice.";
    }
 ?>

这就是我最终所做的,现在它很不好看,但它很管用。现在我需要得到按降序显示的结果。

有人能帮我吗?

最新更新