Giter VIP home page Giter VIP logo

php-qrencode's Introduction

php-qrencode

基于libqrencode+libgd的生成二维码的php扩展

安装:

1,安装libpng & libjpg

sudo apt-get install libpng-dev
sudo apt-get install libjpeg-dev

2,安装libqrencode

wget http://fukuchi.org/works/qrencode/qrencode-3.4.4.tar.gz
tar zxvf qrencode-3.4.4.tar.gz
cd qrencode-3.4.4/
./configure
make&make install

3,安装libgd

sudo apt-get install libgd-dev

4,安装php-qrencode

git clone https://github.com/Leon2012/php-qrencode
cd php-qrencode
phpize
./configure
make&sudo make install

5,修改配置文件

vi php.ini
extension=qrencode.so

用法:

<?php
$resource = qrencode_create("test", 2, 2);
if (!is_null($resource)){
	qrencode_save($resource, "./test.png");//保存文件
}
//echo qrencode_version()."\n";//查看版本号
?>

和phpqrcode对比

php-qrencode代码:

<?php
$t1 = microtime(true);
$qrcode_image = "/Users/kentchen/Downloads/qrencode1.png";
$content = "hello world";
$resource = qrencode_create($content, QRENCODE_QRECLEVEL_Q, QRENCODE_MODE_8);
qrencode_save($resource, $qrcode_image);
$t2 = microtime(true);
echo (($t2-$t1)*1000).':ms';
?>

运行时间:0.60701370239258:ms

phpqrcode代码:

<?php
include('./phpqrcode/phpqrcode.php'); 
$t1 = microtime(true);
$qrcode_image = "/Users/kentchen/Downloads/qrencode2.png";
$content = "hello world";
QRcode::png($content, $qrcode_image, QR_ECLEVEL_Q, 12);
$t2 = microtime(true);
echo (($t2-$t1)*1000).':ms';
?>

运行时间:23.189067840576:ms

php-qrencode's People

Contributors

leon2012 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.