Repository navigation
Replies: 2 comments 7 replies
|
Well after some testing it appears I can't add aything to the URL i.e. https://domain.com/track.php?qr=$randstring If I use $qrcode->addByteSegment("https://danville.qr?$randstring"); it works just fine. What can I do to be able to use special characters in this URL? |
7 replies
|
This is PHP string quoting, not the QR code library. PHP only substitutes variables inside double quotes. In single quotes, $randstring = 'abc123';
echo 'https://domain.com/track.php?qr=$randstring'; // https://domain.com/track.php?qr=$randstring
echo "https://domain.com/track.php?qr=$randstring"; // https://domain.com/track.php?qr=abc123Concatenation is the least surprising way to write it. If the random string can contain characters that aren't URL-safe ( $qrcode->addByteSegment('https://domain.com/track.php?qr=' . rawurlencode($randstring));Byte mode itself accepts any characters, so nothing special is needed on the QR code side. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How can I add a variable in the string of the addByteSegment function?
$qrcode->addByteSegment('https://domain.com/track.php?$randstring');
the URL in the QR code is getting $randstring instead of the string I geenrated. Generator is workjing correctly.
All reactions