Ripa Saha
Ripa Saha

Reputation: 2540

qr code scan result in php

Is it possible to use html tag in qrcode library? I tried below code:-

header('Content-Type:text/html');
include('../QRcode/qrlib.php');
$html = '<h1><b>BMTF</b></h1>'.PHP_EOL;
$html.= '<h1>Gyldig rapport</h1>'.PHP_EOL;
$html.= '<u></u>'.PHP_EOL;
$tempDir = "QRcodePng/";

//echo QRcode::png($html);
QRcode::png($html, $tempDir.'023.png', QR_ECLEVEL_L, 3); 

echo '<img src="QRcodePng/023.png" />';

and I'm getting output like below:-

<h1><b>BMTF</b></h1>
<h1>Gyldig rapport</h1>
<u></u>

Any suggestion on how to get proper scan output???

Upvotes: 2

Views: 3117

Answers (1)

Pierre
Pierre

Reputation: 2100

A QR code can only store some specific data format :

  • Contact data
  • Calendar data
  • URL
  • Email address
  • Phone number
  • SMS
  • Geolocation
  • Plain text

If you store HTML in your QR code, it will be considered as plain text (unless your reader can read HTML). The best way to store HTML in a QR code is to put an URL in the QR Code who redirects to the HTML you want to show.

Upvotes: 2

Related Questions