Using the uniqid () function, we will generate a.
Php qr code with text code#
In this example, we will create a QR code and store it in a given directory. Example 2: Store generated QR code in directory. Output Example 1 Generate QR code using PHP Clue Mediator.
![php qr code with text php qr code with text](https://i.ytimg.com/vi/Qr1iVWRP2sE/maxresdefault.jpg)
![php qr code with text php qr code with text](https://user-images.githubusercontent.com/6616448/143303398-ffcb4939-1ff4-4877-88c1-0bf7ad662daa.jpg)
The $saveandprint parameter indicates whether to save the QR code and display it. The following output will appear when you run scripts that have default frame and pixel size. The parameter $size indicates the size of the generated image, which is 3 by default the parameter $margin indicates the space between the blank areas around the QR code the area covered can also be identified, which are l (QR green L, 7%), M (QR green L, 15%), Q (QR green L, 25%), H (QR green L, 30%) The parameter $level indicates the fault tolerance rate, i.e. The parameter $outfile indicates whether to output the QR code picture file. The parameter $text means to generate two bit information text Public static function png($text, $outfile=false, $level=QR_ECLEVEL_L, $size=3, $margin=4, $saveandprint=false) I used the CI framework, so I changed the first class name qrstr to qrstr, phpqrcode.php to Qrcode.php, put the file in the application/libraries directory, and then loaded the class $this - > Load - > Library ('Qrcode ') in the CI controller file Phpqrcode.php provides a key png() method Of course, your PHP environment must be enabled to support GD2. The first class name is qrstr, and the file name is phpqrcode.Īfter downloading the class library provided by the official website, you only need to use phpqrcode.php to generate QR code.
![php qr code with text php qr code with text](https://linuxhint.com/wp-content/uploads/2021/01/Generate-QR-code-using-PHP_2.jpg)
Open the file and you can see that it consists of multiple classes (I used 1.1.4). (you need to download the phpqrcode class file)