简体   繁体   English

生成QR

[英]Generating a QR

Hi i need to generate a QR, (QR ISO/IEC 18004:2000) 嗨我需要生成QR,(QR ISO / IEC 18004:2000)

Using some data 使用一些数据

re= 
rr=
tt=
id=

Here is an example of a chain. 这是一个链的例子。

$data = "?re=AAA010101AAA&rr=CAJR820905IP1&tt=116.00&id= 556bef95-8322-4897-ae65-3b5e9de593f8"; 

I have found this link: 我找到了这个链接:

http://phpqrcode.sourceforge.net/examples/index.php?example=001 http://phpqrcode.sourceforge.net/examples/index.php?example=001

I have not idea at all, of how to build a QR using my data and that library, can anyone point at my stupidity pls.. 我根本不知道如何使用我的数据和那个库建立QR,任何人都可以指出我的愚蠢。

thanks 谢谢

EDIT Here is the real answer that i get thanks to the advice wich point me in the rigth direction. 编辑这是我得到的真正答案,这要归功于我指向严谨方向的建议。 (thats why i mark it as correct answer). (这就是我将其标记为正确答案的原因)。 Anyway, someone may need this. 无论如何,有人可能需要这个。

To genereate a QR (CBB in other countries) you can use the library http://phpqrcode.sourceforge.net/ 要生成QR(其他国家/地区的CBB),您可以使用库http://phpqrcode.sourceforge.net/

Follow this. 按照这个。 Create a file to generate the QR, in my case (/common/qrcode.php) 创建一个文件来生成QR,在我的情况下(/common/qrcode.php)

Inside this file you must insert the code to generate QR, depending on what you need. 在此文件中,您必须插入代码以生成QR,具体取决于您的需要。 This example03 its pretty good for this. 这个例子03对此非常好。

include('phpqrcode/qrlib.php'); 包括( 'phpqrcode / qrlib.php');

 $param = $_GET['id']; // remember to sanitize that - it is user input! 

    // we need to be sure ours script does not output anything!!! 
    // otherwise it will break up PNG binary! 

    ob_start("callback"); 

    // here DB request or some processing 
    $codeText = 'DEMO - '.$param; 

    // end of processing here 
    $debugLog = ob_get_contents(); 
    ob_end_clean(); 

    // outputs image directly into browser, as PNG stream 
    QRcode::png($codeText);

Then in your view or page where you want to display the QR, you can do this, 然后在您要显示QR的视图或页面中,您可以执行此操作,

$ourParamId = 1234; 

     echo '<img src="/common/qrcode.php?id='.$ourParamId.'" />'; 

Hopes this helps someone. 希望这有助于某人。

Check out : example 3 . 退房: 示例3

A QR Code simply represents a text string. QR码仅表示文本字符串。

 // here DB request or some processing 
$codeText = 'DEMO - '.$param;  
$codeText = 'YOUR TEXT GOES HERE';

Well, the link that you have mentioned in the question is the answer: 那么,您在问题中提到的链接就是答案:

<?php 

    include('../lib/full/qrlib.php'); 

    // outputs image directly into browser, as PNG stream 
    QRcode::png('PHP QR Code :)');

So you can have a page which accepts the data and displays the QR code as an image and you can have a script that reads the image and save it to DB or filesystem. 因此,您可以拥有一个接受数据并将QR代码显示为图像的页面,您可以使用一个脚本来读取图像并将其保存到DB或文件系统中。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM