Reputation: 67
I would like to generate many QR code using "Simple QrCode" https://www.simplesoftware.io/docs/simple-qrcode
I can make one QR code like this
{!! QrCode::size(100)->generate('http://www.mywebsite.com') !!}
but how do I make alot.
I'm beginer this code looks not good. sorry. I can make loop but loop numbers doesn't work.
<table border="1">
<?php
for ($i=1; $i<5; $i++) {
$url = "http://localhost/acex/1.php?g=". $i;
$qr = '{!! QrCode::size(100)->generate(' . $url .') !!}';
echo "<a href=\"http://localhost/acex/1.php?g=". $i . "\">link </a>";
echo"<br>";
?>
<tr>
<td>
<?php
echo "<a href=\"http://localhost/acex/1.php?g=". $i . "\">link </a>";
?>
</td>
<td>
<?php
echo $qr;
?>
</td>
<td>
<?php
echo $url;
?>
</td>
</tr>
<?php
}
?>
</table>
Upvotes: 0
Views: 3814
Reputation: 26
As you already use SimpleSoftwareIO, just write:
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
and put this code in your loop:
$qrcode = new BaconQrCodeGenerator;
$qrcode->size(100)->generate("your text", 'path to save file');
It worked for me.
Upvotes: 1