$msg"; } function read_log($logfile) { $fp = fopen("/xtmp/{$logfile}.log", 'r'); $pos = -1; // Skip final new line character (Set to -1 if not present) $lines = array(); $currentLine = ''; $idx = 0; $msg = "
";
while (-1 !== fseek($fp, $pos, SEEK_END)) {
$char = fgetc($fp);
if (PHP_EOL == $char) {
$msg .= $currentLine;
echo $msg;
$currentLine = '';
} else {
$currentLine = $char . $currentLine;
}
$pos--;
$idx++;
if ($idx > 1000) {
break;
}
}
$msg .= "";
return $msg;
}
function index()
{
$fp = file_get_contents("/xtmp/future_order.log");
$arr = explode("\n", $fp);
$arr = array_slice($arr, -500);
$arr = array_reverse($arr);
$msg = implode("\n", $arr);
echo "$msg"; } }