Line | |
---|
1 | <?php |
---|
2 | require_once ('jpgraph/QR/qrencoder.inc.php'); |
---|
3 | |
---|
4 | // Data to be encoded |
---|
5 | $data = '01234567'; |
---|
6 | |
---|
7 | // Create a new instance of the encoder and let the library |
---|
8 | // decide a suitable QR version and error level |
---|
9 | $encoder = new QREncoder(1); |
---|
10 | |
---|
11 | // Use the image backend (this is also the default) |
---|
12 | $backend = QRCodeBackendFactory::Create($encoder); |
---|
13 | |
---|
14 | try { |
---|
15 | // . send the QR Code back to the browser |
---|
16 | $backend->Stroke($data); |
---|
17 | } catch (Exception $e) { |
---|
18 | $errstr = $e->GetMessage(); |
---|
19 | echo 'QR Code error: '.$e->GetMessage()."\n"; |
---|
20 | exit(1); |
---|
21 | } |
---|
22 | |
---|
23 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.