mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 20:17:17 +00:00
updated HTML example
This commit is contained in:
+34
-13
@@ -2,34 +2,55 @@
|
||||
|
||||
require_once '../vendor/autoload.php';
|
||||
|
||||
use codemasher\QRCode\QRCode;
|
||||
use codemasher\QRCode\QRConst;
|
||||
use chillerlan\QRCode\Output\QRString;
|
||||
use chillerlan\QRCode\Output\QRStringOptions;
|
||||
use chillerlan\QRCode\QRCode;
|
||||
use chillerlan\QRCode\QRConst;
|
||||
use chillerlan\QRCode\QROptions;
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
echo '<style>
|
||||
.qrcode{
|
||||
border-style:none;
|
||||
border-collapse:collapse;
|
||||
|
||||
.qrcode,
|
||||
.qrcode > p,
|
||||
.qrcode > p > b,
|
||||
.qrcode > p > i {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.dark, .light{
|
||||
margin:0;
|
||||
padding:0;
|
||||
/* row element */
|
||||
.qrcode > p {
|
||||
height: 1.25mm;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* column element(s) */
|
||||
.qrcode > p > b, .qrcode > p > i{
|
||||
display: inline-block;
|
||||
width: 1.25mm;
|
||||
height: 1.25mm;
|
||||
}
|
||||
|
||||
.dark{
|
||||
.qrcode > p > b{
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.light{
|
||||
.qrcode > p > i{
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
</style>';
|
||||
|
||||
// google authenticator
|
||||
$qr = new QRCode('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net', QRConst::ERROR_CORRECT_LEVEL_M);
|
||||
echo $qr->printHTML();
|
||||
$qrStringOptions = new QRStringOptions;
|
||||
$qrStringOptions->type = QRConst::OUTPUT_STRING_HTML;
|
||||
|
||||
$qrOptions = new QROptions;
|
||||
$qrOptions->typeNumber = QRConst::TYPE_05;
|
||||
$qrOptions->errorCorrectLevel = QRConst::ERROR_CORRECT_LEVEL_M;
|
||||
$qrOptions->output = new QRString($qrStringOptions);
|
||||
|
||||
$qr = new QRCode('skype://callto:echo123', $qrOptions);
|
||||
|
||||
echo '<div class="qrcode">'.$qr->output().'</div>';
|
||||
|
||||
Reference in New Issue
Block a user