PHP產生二維碼:dcode

來源:互聯網
上載者:User
一個基於QR Code encoder的產生二維碼的php擴充,同時實現了Discuz論壇系統裡面的authcode函數,相比php版本速度更快,產生幾萬個二維碼秒秒鐘。如果使用Discuz論壇,需要有這方面效能提升的,那麼該擴充時不錯的選擇。

依賴: php5.4+ libpng

範例程式碼:

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);

項目首頁:http://www.open-open.com/lib/view/home/1441010675112

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.