Skip to main content

✅QR-Gen.php

Here's a page that helps you convert text into a QR code that can be scanned.

<!DOCTYPE html>
<html>
<head>
    <title>Text2QR Gen</title>
    <!-- 引入QR码生成器 -->
    <script src="https://cdn.bootcss.com/qrcodejs/1.0.0/qrcode.min.js"></script>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=0.8">
    <style>
        @media (max-width: 980px) {
          body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #007eca;
          }
        }
        @media (min-width: 981px) {
          body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #007eca;
            background-image: url("https://dl.itslittlekevin.com/projects/5069.png");
            background-repeat: no-repeat;
            background-position: right center;
            background-size: auto 100%;
          }
        }
        h1, p, h4 {
          text-shadow: 2px 2px 2px #00000055;
        }
        
        #input-container, #btn-container {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 20px;
        }
        input[type="text"] {
            color: black;
            margin: 10px;
            border-radius: 5px;
            padding: 5px 15px
        }
        * {
            color: white;
        }
        #qrcode,#btn-container {
            display: none;
        }
        button {
            font-size: 15px;
            background-color: #00325565;
            padding: 5px 15px;
            border-radius: 5px;
            border-width: 0px;
            margin: 5px;
            cursor: pointer;
        }
        #refresh-btn {
            margin-left: 10px;
        }
        /* 添加间距 */
        .spacer {
            height: 55px;
        }
        h4 a {
            text-decoration: none;
    </style>
</head>
<body>
    <h1 align="center">二维码生成器 <br> QR Code Generator</h1>
    <div id="input-container">
        <input type="text" placeholder="输入文本/Input Your Text" id="text-input">
        <div style="height:10px;"></div> <!-- 添加间距 -->
        <button onclick="generateQR()">生成 | Generate</button>
    </div>
    <div id="qrcode"></div>
    <!-- 添加间距 -->
    <div class="spacer"></div>
    <div id="btn-container">
        <button id="refresh-btn" onclick="refresh()"> 刷新 | Clear </button>
    </div>
    <h4><a href="https://itslittlekevin.com/gadgetslist">»返回工具列表 | Return to Gadgets List«</a></h4>
    <script>
        var qr = new QRCode("qrcode");
        var inputContainer = document.querySelector("#input-container");
        var qrcodeContainer = document.querySelector("#qrcode");
        var btnContainer = document.querySelector("#btn-container");
        var textInput = document.querySelector("#text-input");

        function generateQR() {
            if (textInput.value) {
                qr.makeCode(textInput.value);
                inputContainer.style.display = "none";
                qrcodeContainer.style.display = "block";
                btnContainer.style.display = "flex";
            }
        }

        function refresh() {
            textInput.value = "";
            inputContainer.style.display = "flex";
            qrcodeContainer.style.display = "none";
            btnContainer.style.display = "none";
            qr.clear();
        }
    </script>
</body>
</html>