PHP - 显示文件底部的输出

时间:2015-03-01 11:26:34

标签: php

<?php

$file = 'C:\wamp\www\Killboard\EPChernarus1\PhitLog.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.";
}

?>

如何让它首先显示文件底部的行? 我猜测某种阵列反向,但我无法做到这一点。

有人能告诉我吗?

1 个答案:

答案 0 :(得分:0)

更改

echo '', implode(" <br>", $matches[0]);

echo '', implode(" <br>", array_reverse($matches[0]));