当前位置: 首页>>代码示例>>PHP>>正文


PHP QRtools::buildCache方法代码示例

本文整理汇总了PHP中QRtools::buildCache方法的典型用法代码示例。如果您正苦于以下问题:PHP QRtools::buildCache方法的具体用法?PHP QRtools::buildCache怎么用?PHP QRtools::buildCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QRtools的用法示例。


在下文中一共展示了QRtools::buildCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: qrtest

 public static function qrtest()
 {
     // Include only this file, remaining required files will be included from it
     if (!class_exists("qrstr", FALSE)) {
         require_once PATH_PHPQRCODE . "/qrlib.php";
     }
     //write code into file, Error corection lecer is lowest, L (one form: L,M,Q,H)
     //each code square will be 4x4 pixels (4x zoom)
     //code will have 2 code squares white boundary around
     if (1) {
         // Error correction level L : About 7% or less errors can be corrected.
         // Error correction level M : About 15% or less errors can be corrected.
         // Error correction level Q : About 25% or less errors can be corrected.
         // Error correction level H : About 30% or less errors can be corrected.
         $text = "http://www.nordita.org/guest/";
         $filetype = "png";
         // "png","svg","eps","txt"
         if (!in_array($filetype, array("png", "svg", "eps", "txt"))) {
             return FALSE;
         }
         $level = "H";
         // "L" (default) ,"M", "Q", "H"
         $pixelsize = 16;
         // pixel size of each code square
         $margin = 4;
         // boundary width in number of code squares
         $saveandprint = FALSE;
         // TRUE = save to file and display in browser; FALSE = save to file only; redundant if $outfile=FALSE
         $back_color = 0xffffff;
         $fore_color = 0x0;
         $cmyk = TRUE;
         $filename = "qrcode";
         $outfile = PATH_PHPQRCACHE . $filename . "." . $filetype;
         // full file path or FALSE (only output on screen)
         //$outfile      = FALSE;
         switch ($filetype) {
             case "png":
                 QRcode::png($text, $outfile, $level, $pixelsize, $margin, $saveandprint, $back_color, $fore_color);
                 break;
             case "eps":
                 QRcode::eps($text, $outfile, $level, $pixelsize, $margin, $saveandprint, $back_color, $fore_color, $cmyk);
                 break;
             case "svg":
                 QRcode::svg($text, $outfile, $level, $pixelsize, $margin, $saveandprint, $back_color, $fore_color);
                 break;
             case "txt":
                 QRcode::text($text, $outfile, $level, $pixelsize, $margin);
                 // black = "1", white = "0"
                 break;
         }
         // end switch
     }
     //same as above but outputs file directly into browser (with appr. header etc.)
     //all other settings are default
     //WARNING! it should be FIRST and ONLY output generated by script, otherwise
     //rest of output will land inside PNG binary, breaking it for sure
     if (0) {
         QRcode::png("PHP QR Code :)");
     }
     //show benchmark
     if (0) {
         QRtools::timeBenchmark();
     }
     //rebuild cache
     if (0) {
         QRtools::buildCache();
     }
     //code generated in text mode - as a binary table
     //then displayed out as HTML using Unicode block building chars :)
     if (0) {
         $qr = new QRencode();
         $tab = $qr->encode('PHP QR Code :)');
         QRspec::debug($tab, true);
     }
 }
开发者ID:,项目名称:,代码行数:75,代码来源:


注:本文中的QRtools::buildCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。