Toggle theme
Kacper's Wiki
Narzędzia użytkownika
Toggle theme
Zaloguj
Narzędzia witryny
Szukaj
Narzędzia
Pokaż stronę
Poprzednie wersje
Odnośniki
Ostatnie zmiany
Menadżer multimediów
Indeks
Zaloguj
>
Ostatnie zmiany
Menadżer multimediów
Indeks
Ślad:
narzedzia:qrcode_gen
Ta strona jest tylko do odczytu. Możesz wyświetlić źródła tej strony ale nie możesz ich zmienić.
====== PHP: QR code generator ====== Prosty skrypt w PHP wykorzystujący bibliotekę [[https://phpqrcode.sourceforge.net/|phpqrcode]] do generowania kodów QR Link do programu: https://wiki.ostrowski.net.pl/qrcode/ Dla wygenerowania kodu QR dla sieci wifi wystarczy zedytować i wkleić do generatora ten tekst: <code> WIFI:T:<encryption>;S:<SSID>;P:<password>;H:<hidden>;; </code> Wyjaśnienie: * ''T'': Rodzaj szyfrowania (WPA, WPA2, WPA3, WEP, or nopass for open networks) * ''S'': SSID (nazwa sieci WiFi) * ''P'': Hasło * ''H'': ukryty SSID (true false) Przykład: <code> WIFI:T:WPA;S:quest-network;P:pass1234;; </code> Kod rozwiązania: <code php index.php> <?php require_once './phpqrcode/qrlib.php'; // include the QR library ?> <!DOCTYPE html> <html> <head> <title>Simple QR Code Generator</title> </head> <body> <h2>QR Code Generator</h2> <form method="post"> Enter text or URL: <input type="text" name="text" required style="width: 400px;"> <button type="submit">Generate QR Code</button> </form> <p>if you want wifi qrcode then edit and paste this: <tt>WIFI:T:WPA;S:quest-network;P:pass1234;;</tt></p> <?php if (!empty($_POST['text'])) { $text = $_POST['text']; $filename = 'qrcode.png'; // Dynamically adjust the size based on the length of the input text $dataLength = strlen($text); $size = 5; // Default size if ($dataLength <= 50) { $size = 5; // Small amount of data } elseif ($dataLength <= 100) { $size = 6; // Medium amount of data } elseif ($dataLength <= 200) { $size = 7; // Larger data } elseif ($dataLength <= 300) { $size = 8; // Even larger data } else { $size = 9; // Very large data } // Create the QR code with the calculated size QRcode::png($text, $filename, QR_ECLEVEL_L, $size); echo "<h3>Your QR Code:</h3>"; echo "<img src='$filename'><br>"; echo "<a href='$filename' download>Download QR Code</a>"; } ?> </body> </html> </code>
narzedzia/qrcode_gen.txt
· ostatnio zmienione: 2025/05/16 18:46 przez
administrator
Narzędzia strony
Pokaż stronę
Poprzednie wersje
Odnośniki
Do góry