ログ表示まで
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
/log.txt
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ja">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<?php foreach (array_reverse ($log_data) as $record): ?>
|
||||||
|
<div style="margin-bottom: 24px">
|
||||||
|
<div>
|
||||||
|
<?= $record['date_time'] ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<img src="<?= $record['chat_icon'] ?>" />
|
||||||
|
<?= $record['chat_name'] ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="color: blue">
|
||||||
|
> <span style="font-style: italic"><?= $record['chat_message'] ?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<?= $record['answer'] ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|||||||
+24
-1
@@ -1,6 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
const LOG_PATH = '/home/miteruzo/Downloads/nizika_broadcast/log.txt';
|
const LOG_PATH = './log.txt';
|
||||||
|
|
||||||
|
$log_data = [];
|
||||||
|
|
||||||
|
$f = fopen (LOG_PATH, 'r');
|
||||||
|
|
||||||
|
if ($f !== false)
|
||||||
|
{
|
||||||
|
while (($dt = fgetcsv ($f, 0, "\t")) !== false)
|
||||||
|
{
|
||||||
|
$chat_info = json_decode ($dt[1]);
|
||||||
|
|
||||||
|
$log_data[] = ['date_time' => $dt[0],
|
||||||
|
'chat_icon' => $chat_info -> author -> imageUrl,
|
||||||
|
'chat_name' => $chat_info -> author -> name,
|
||||||
|
'chat_message' => $chat_info -> message,
|
||||||
|
'answer' => $dt[2]];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose ($f);
|
||||||
|
|
||||||
|
unset ($f);
|
||||||
|
|
||||||
require_once './index.frm.php';
|
require_once './index.frm.php';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user