<title>我来了</title>
<style>
img {
    border-radius: 10px;
}
</style>
<?php
// 读取 txt 文件中的两行数据
function getTwoLines($file) {
    $data = file($file);
    $num = count($data);
    $id1 = mt_rand(0, $num - 1);
    $id2 = mt_rand(0, $num - 1);
    $line1 = trim($data[$id1]);
    $line2 = trim($data[$id2]);
    return $line1 . ' ' . $line2;
}

// 获取合并的两行文本
$mergedText = getTwoLines('aaaa.txt');
echo "<br/>";
echo "<br/>";
echo "<br/>";
// 显示加粗加大的文本
echo '<span style="font-weight: bold; font-size: 40px; display: block; text-align: center;">' . $mergedText . '</span>';
echo "<br/>";
echo "<br/>";
echo "<br/>";
// 添加复制按钮
echo '<img src="a1.jpg" width=400 height=150 alt="复制" onclick="copyToClipboard()" style="cursor: pointer; display: block; margin: 0 auto; right:300px; position: fixed; top:200px">';
echo "<br/>";
echo "<br/>";
echo "<br/>";
// 添加刷新页面按钮
echo '<img src="a2.jpg" width=400 height=150 alt="刷新" onclick="window.location.reload()" style="cursor: pointer; display: block; margin: 0 auto; right:300px; position: fixed; top:380px">';
echo "<br/>";
// JavaScript 函数：复制文本到剪贴板
echo '<script>
function copyToClipboard() {
    const el = document.createElement("textarea");
    el.value = "' . $mergedText . '";
    document.body.appendChild(el);
    el.select();
    document.execCommand("copy");
    document.body.removeChild(el);
}
</script>';
?>
