PHP generates a QR code: dcode

Source: Internet
Author: User
Php qr Code generation: dcode is a php extension that generates QR Code based on QR Code encoder. It also implements the authcode function in the Discuz forum system, which is faster than the php version, tens of thousands of QR codes are generated in seconds. If you want to use the Discuz forum to improve performance in this aspect, it is a good choice for this extension.

Dependency: php5.4 + libpng

Sample code:

DCode::encrypt($src, $key = "THIS IS SHIT", $ckeylength = 8, $expire = 0);DCode::decrypt($src, $key = "THIS IS SHIT", $ckeylength = 8); /** * DCode::qrcode($str, $version = 0, $level = QR_ECLEVEL_L, $mode = QR_MODE_KANJI, $casesensitive = 0);* @param $str;* @param $version = 0;* @param $level = QR_ECLEVEL_L;* @param $model = QR_MODE_KANJI;* @param $casesensitive = 0;* @return string*/$filecontent = DCode::qrcode("HELLO");file_put_contents("test.png", $filecontent); /*** DCode::qrcode8bit($str, $version = 0, $level = QR_ECLEVEL_L);* @param $str;* @param $version = 0;* @param $level = QR_ECLEVEL_L;* @return string*/$filecontent = DCode::qrcode8bit("HELLO WORLD");file_put_contents("test1.png", $filecontent); /*** DCode::qrcodedata($sizeof, $data, $version = 0, $level = QR_ECLEVEL_L);* @param $sizeof* @param $data* @param $version = 0;* @param $level = QR_ECLEVEL_L;* @return string*/$filecontent = DCode::qrcodedata(strlen("HELLO WORLD"), "HELLO WORLD");file_put_contents("test2.png", $filecontent); dcode_encrypt($src, $key = "THIS IS SHIT", $ckeylength = 8, $expire = 0);dcode_decrypt($src, $key = "THIS IS SHIT", $ckeylength = 8); $filecontent = dcode_qrcode("HELLO");file_put_contents("test.png", $filecontent); $filecontent = dcode_qrcode8bit("HELLO 8bit");file_put_contents("test1.png", $filecontent); $filecontent = dcode_qrcodedata(strlen("HELLO 8bit"), "HELLO 8bit");file_put_contents("test2.png", $filecontent);

Project homepage:Http://www.open-open.com/lib/view/home/1441010675112

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.