• ecstore生成二维码


    利用phpqrcode库生成二维码:

     1         /*
     2          *二维码添加
     3          */
     4         //////////////////////////////////////
     5         /*引入文件*/
     6         @include(APP_DIR.'/include/lib/weixin/phpqrcode.php');
     7         /*默认存放路径*/
     8         $save_path = PUBLIC_DIR.'/weixin/';//储存地址
     9         if (!file_exists($save_path)) {
    10             mkdir($save_path);
    11         }
    12         $path    = $save_path.$deptId.'.png ';
    13         $path   = strstr($path, '/');
    14         $errorCorrectionLevel = "H";
    15         $matrixPointSize = "4";
    16         if(!file_exists($path)){
    17             $c = 'www.baidu.com';
    18             QRcode::png($c, $save_path.$deptId.'.png',$errorCorrectionLevel,$matrixPointSize);
    19         }
    20         $this->pagedata['img'] = kernel::base_url(1).'/weixin/'.$deptId.'.png';
    21         ///////////////////////////////////////

    利用google接口生成二维码:

     1     /*
     2      * 生成二维码调用google接口
     3      * @var array $params
     4      * @access public
     5      * @return string
     6      */
     7     function generateQRfromGoogle($data,$widhtHeight='205',$EC_level='H',$margin='0'){
     8 
     9         $url=urlencode($data);
    10 
    11         return '<img src="http://chart.apis.google.com/chart?chs='.$widhtHeight.'x'.$widhtHeight.'&cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$url.'" widhtHeight="'.$widhtHeight.'" widhtHeight="'.$widhtHeight.'"/>';
    12 
    13     }//End Function

    还有一种方法:调用jquery.qrcode.js库生成二维码:具体实例就不写了

  • 相关阅读:
    SpringData JPA接口总结
    使用allatori混淆代码
    Oracle查看表空间大小
    Mac常用命令
    Web.config或App.config下section
    ansi、unicode、UCS、UTF等概念(转)
    强名称程序集与GAC
    指针和引用的区别(转)
    .NET程序员应该知道些什么(转)
    dispose,null和close的区别
  • 原文地址:https://www.cnblogs.com/CHEUNGKAMING/p/4081872.html
Copyright © 2020-2023  润新知