Closed walker6o9 closed 1 year ago
I'm trying to enter a website as the qrcode, something like google.com/test or https://google.com/test
When I do that, instead of a barcode I get:
���?n�h�
My code is pretty simple: public function actionQrcode($id = 1, $size = 100, $margin = 80) { $text = "www.google.com/test"; $qrCode = (new QrCode($text)) ->setSize($size) ->setMargin($margin) ->useForegroundColor(0, 0, 0) ->setLabel($id);
$image_path = Yii::$app->basePath . '/web/uploads/barcodes/'; if (!file_exists($image_path)) { mkdir($image_path, 0777, TRUE); } $qrCode->writeFile($image_path . $id . '.png'); // writer defaults to PNG when none is specified
// display directly to the browser header('Content-Type: ' . $qrCode->getContentType()); echo $qrCode->writeString(); }
hi @walker6o9 have you tried escaping the slash or use single quotes?
"https:\/\/google.com\/" or 'https://google.com'
no return from requester
I'm trying to enter a website as the qrcode, something like google.com/test or https://google.com/test
When I do that, instead of a barcode I get:
���?n�h�
My code is pretty simple: public function actionQrcode($id = 1, $size = 100, $margin = 80) { $text = "www.google.com/test"; $qrCode = (new QrCode($text)) ->setSize($size) ->setMargin($margin) ->useForegroundColor(0, 0, 0) ->setLabel($id);
// display directly to the browser header('Content-Type: ' . $qrCode->getContentType()); echo $qrCode->writeString(); }