本文整理汇总了PHP中QRcode类的典型用法代码示例。如果您正苦于以下问题:PHP QRcode类的具体用法?PHP QRcode怎么用?PHP QRcode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QRcode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: genqrm
public static function genqrm($nombre, $ap, $am, $com, $filename)
{
$QR_TEMP_DIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'qrimg' . DIRECTORY_SEPARATOR;
$HTML_TEMP_DIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR;
$QR_WEB_DIR = "qrimg/";
$HTML_WEB_DIR = "html/";
include "phpqrcode.php";
if (!file_exists($QR_TEMP_DIR)) {
mkdir($QR_TEMP_DIR);
}
if (!file_exists($HTML_TEMP_DIR)) {
mkdir($HTML_TEMP_DIR);
}
$fileimg = $QR_TEMP_DIR . 'test.png';
$errorCorrectionLevel = 'Q';
$matrixPointSize = 6;
$filenameqr = $QR_WEB_DIR . $filename;
$filenamehtml = $HTML_WEB_DIR . $filename;
$fileimg = $filenameqr . '.png';
$filehtml = $filenamehtml . '.html';
$filehtmlqr = "192.168.1.5/demo/qr/" . $filehtml;
QRcode::png($filehtmlqr, $fileimg, $errorCorrectionLevel, $matrixPointSize, 2);
$mensaje = "\n\n <!DOCTYPE html>\n <html>\n <head>\n\n <title></title>\n </head>\n <body>\n\n Nombre: '{$nombre}' '{$ap}' '{$am}' <br><br>\n Comentario: '{$com}'\n\n </body>\n </html>\n\n ";
if ($archivo = fopen($filehtml, "a")) {
fwrite($archivo, $mensaje);
fclose($archivo);
}
echo '<img src="' . $QR_WEB_DIR . basename($fileimg) . '" />
<br>Datos guardados <a href="./index.php">Regresar</a><br>';
return $fileimg;
}
开发者ID:andresmayahii,项目名称:demomactrainee,代码行数:33,代码来源:genqr.php
示例2: logo
public function logo()
{
Vendor("phpqrcode.phpqrcode");
$QRcode = new \QRcode();
$path = "data/rq/";
$value = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?token=' . session('token');
$fileName = $path . session('token') . '_emall.png';
$QR_Logo = $path . session('token') . '_emall_Logo.png';
$errorCorrectionLevel = 'H';
$matrixPointSize = 10;
$QRcode->png($value, $fileName, $errorCorrectionLevel, $matrixPointSize, 2);
$logo = $path . 'weixinlogo.jpg';
$QR = $fileName;
if ($logo !== FALSE) {
$QR = imagecreatefromstring(file_get_contents($QR));
$logo = imagecreatefromstring(file_get_contents($logo));
$QR_width = imagesx($QR);
$QR_height = imagesy($QR);
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
$logo_qr_width = $QR_width / 5;
$scale = $logo_width / $logo_qr_width;
$logo_qr_height = $logo_height / $scale;
$from_width = ($QR_width - $logo_qr_width) / 2;
imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
}
imagepng($QR, $QR_Logo);
$this->assign('QR_Logo', $QR_Logo);
$this->display();
if (IS_AJAX) {
$response = $this->fetch();
$this->ajaxReturn(1, '', $response);
}
}
开发者ID:yaks,项目名称:weixinshop,代码行数:34,代码来源:templetAction.class.php
示例3: qrcode
public function qrcode()
{
Vendor('Phpqrcode.phpqrcode');
$url = I("url");
$size = I("size") ? I("size") : 6;
$object = new \QRcode();
$object->png($url, false, 3, $size, 2);
}
开发者ID:star7th,项目名称:showdoc,代码行数:8,代码来源:CommonController.class.php
示例4: twofactors_getQR
function twofactors_getQR()
{
global $srcdir;
require_once $srcdir . '/libs/phpqrcode/phpqrcode.php';
$text = sprintf("otpauth://totp/%s@%s?secret=%s&issuer=LATEB", $_SESSION['user']['user_name'], $_SERVER['HTTP_HOST'], $_SESSION['user']['GoogleAuthenticator']);
$qrcode = new QRcode();
$qrcode->png($text, false, QR_ECLEVEL_M, 5);
quit();
}
开发者ID:bontiv,项目名称:intrateb,代码行数:9,代码来源:twofactors.php
示例5: qrcode
/**
* host 生成链接地址
* level 容错级别
* size 图片大小
*/
public function qrcode($url = 'http://www.jihexian.com', $level = 3, $size = 4)
{
Vendor('phpqrcode.phpqrcode');
$errorCorrectionLevel = intval($level);
//容错级别
$matrixPointSize = intval($size);
//生成图片大小
//生成二维码图片
//echo $_SERVER['REQUEST_URI'];
$object = new \QRcode();
$object->png($url, false, $errorCorrectionLevel, $matrixPointSize, 2);
}
开发者ID:u0mo5,项目名称:app,代码行数:17,代码来源:QRcodeController.class.php
示例6: get_qr_image
public function get_qr_image($qrfile_prefix = 'qr_', $size = 4, $outer_margin = 2)
{
$url = wpl_global::get_full_url();
$file_name = $qrfile_prefix . md5($url) . '.png';
$file_path = wpl_global::get_upload_base_path() . 'qrcode' . DS . $file_name;
if (!wpl_file::exists($file_path)) {
if (!wpl_file::exists(dirname($file_path))) {
wpl_folder::create(dirname($file_path));
}
$QRcode = new QRcode();
$QRcode->png($url, $file_path, 'L', $size, $outer_margin);
}
return wpl_global::get_upload_base_url() . 'qrcode/' . $file_name;
}
开发者ID:amankatoch,项目名称:wp-plugin,代码行数:14,代码来源:main.php
示例7: createQR
public function createQR()
{
$info = collectinfo(__METHOD__, '', array());
$qr = M('qr');
//先取一个tempuid
$tmpuid = time() . rand(10, 99);
//加上随机数几乎是杜绝了统一时间一起产生的临时uid的可能性
$this->assign('tmpuid', $tmpuid);
$isscan = 0;
$openid = '';
$data = array('tmpuid' => $tmpuid, 'isscan' => $isscan, 'openid' => $openid);
$qr->data($data)->add();
$pic = './Public/img/qr/' . $tmpuid . '.png';
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx682ad2cc417fe8b9&redirect_uri=http://www.evchar.cn/evcpc/oauth2_openid.php&response_type=code&scope=snsapi_base&state=" . $tmpuid . "&connect_redirect=1#wechat_redirect";
include "phpqrcode.php";
$c = $url;
$data = 'http://www.baidu.com';
// 纠错级别:L、M、Q、H
$level = 'L';
// 点的大小:1到10,用于手机端4就可以了
$size = 4;
// 下面注释了把二维码图片保存到本地的代码,如果要保存图片,用$fileName替换第二个参数false
//$path = "images/";
// 生成的文件名
//$fileName = $path.$size.'.png';
//只认从根目录去找的。。
QRcode::png($c, $pic, $level, $size);
$this->assign('pic', $pic);
return createarrok('ok', $pic, '', $info);
}
开发者ID:PaulSunbinovic,项目名称:evcpc,代码行数:30,代码来源:WXModel.class.php
示例8: QRcode
public function QRcode()
{
include './PigCms/Lib/ORG/phpqrcode.php';
$viewUrl = C('site_url') . U('Wap/Index/index', array('token' => $this->token));
$url = urldecode($viewUrl);
QRcode::png($url, false, 0, 8);
}
开发者ID:kevicki,项目名称:pig,代码行数:7,代码来源:TmplsAction.class.php
示例9: mark_phpqrcode
function mark_phpqrcode($filename = "", $thisurl = '')
{
$uid = $this->Session->read('User.uid');
if (empty($filename)) {
$filename = SYS_PATH_PHOTOS . 'qcody' . DS . $uid . DS . $filename;
}
include SYS_PATH . 'inc/phpqrcode.php';
// 二维码数据
$issubscribe = 0;
if (empty($thisurl)) {
if ($uid > 0) {
$sql = "SELECT is_subscribe FROM `{$this->App->prefix()}user` WHERE user_id = '{$uid}' LIMIT 1";
$issubscribe = $this->App->findvar($sql);
}
if ($issubscribe == '0') {
$to_wecha_id = $this->get_user_parent_uid();
$thisurl = ADMIN_URL . "?toid=" . $to_wecha_id . "&tid=" . $uid;
} else {
$thisurl = ADMIN_URL . "?tid=" . $uid;
}
}
// 生成的文件名
Import::fileop()->checkDir($filename);
// 纠错级别:L、M、Q、H
$errorCorrectionLevel = 'L';
// 点的大小:1到10
$matrixPointSize = 6;
QRcode::png($thisurl, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
}
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:29,代码来源:controller.php
示例10: index
/**
* Account sign up
*
* @access public
* @return void
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect signed in users to homepage
if ($this->authentication->is_signed_in()) {
redirect('');
}
// Check recaptcha
$recaptcha_result = $this->recaptcha->check();
// Store recaptcha pass in session so that users only needs to complete captcha once
if ($recaptcha_result === TRUE) {
$this->session->set_userdata('sign_up_recaptcha_pass', TRUE);
}
// Setup form validation
$this->form_validation->set_error_delimiters('<span class="field_error">', '</span>');
$this->form_validation->set_rules(array(array('field' => 'sign_up_username', 'label' => 'lang:sign_up_username', 'rules' => 'trim|required|alpha_dash|min_length[2]|max_length[24]'), array('field' => 'sign_up_password', 'label' => 'lang:sign_up_password', 'rules' => 'trim|required|min_length[6]'), array('field' => 'sign_up_email', 'label' => 'lang:sign_up_email', 'rules' => 'trim|required|valid_email|max_length[160]')));
// Run form validation
if ($this->form_validation->run() === TRUE && $this->config->item("sign_up_enabled")) {
// Check if user name is taken
if ($this->username_check($this->input->post('sign_up_username')) === TRUE) {
$data['sign_up_username_error'] = lang('sign_up_username_taken');
} elseif ($this->email_check($this->input->post('sign_up_email')) === TRUE) {
$data['sign_up_email_error'] = lang('sign_up_email_exist');
} elseif (!($this->session->userdata('sign_up_recaptcha_pass') == TRUE || $recaptcha_result === TRUE) && $this->config->item("sign_up_recaptcha_enabled") === TRUE) {
$data['sign_up_recaptcha_error'] = $this->input->post('recaptcha_response_field') ? lang('sign_up_recaptcha_incorrect') : lang('sign_up_recaptcha_required');
} else {
// Remove recaptcha pass
$this->session->unset_userdata('sign_up_recaptcha_pass');
// Create user
$user_id = $this->account_model->create($this->input->post('sign_up_username', TRUE), $this->input->post('sign_up_email', TRUE), $this->input->post('sign_up_password', TRUE));
// Add user details (auto detected country, language, timezone)
$this->account_details_model->update($user_id);
// Create folder for specific user if not found
if (!file_exists(RES_DIR . "/user/" . $user_id)) {
mkdir(RES_DIR . "/user/" . $user_id);
copy(RES_DIR . "/user/index.html", RES_DIR . "/user/" . $user_id . "/index.html");
}
// Generate QR Code
if (!file_exists(RES_DIR . "/user/" . $user_id . "/qr-" . $user_id . ".png")) {
include RES_DIR . '/adminlte/plugins/qrcode/phpqrcode/qrlib.php';
QRcode::png("#" . $user_id . "#" . $this->input->post('sign_up_username', TRUE) . "#" . $this->input->post('sign_up_email', TRUE), RES_DIR . "/user/" . $user_id . "/qr-" . $user_id . ".png", "H", 10, 2);
}
// Auto sign in?
if ($this->config->item("sign_up_auto_sign_in")) {
// Run sign in routine
$this->authentication->sign_in($user_id);
}
redirect('account/sign_in');
}
}
// Load recaptcha code
if ($this->config->item("sign_up_recaptcha_enabled") === TRUE) {
if ($this->session->userdata('sign_up_recaptcha_pass') != TRUE) {
$data['recaptcha'] = $this->recaptcha->load($recaptcha_result, $this->config->item("ssl_enabled"));
}
}
// Load sign up view
$this->load->view('sign_up', isset($data) ? $data : NULL);
}
开发者ID:erwiensatrya,项目名称:dentalclinic,代码行数:66,代码来源:sign_up.php
示例11: qrAction
public function qrAction()
{
$url = I('get.raw');
$url = base64_decode($url);
import_third('qrcode.phpqrcode');
\QRcode::png($url, false, QR_ECLEVEL_Q, 8);
}
开发者ID:devsnippet,项目名称:microbuilder,代码行数:7,代码来源:UtilityController.class.php
示例12: init
public function init(){
//ofcourse we need rights to create temp dir
if (!file_exists($this->pngTempDir))
mkdir($this->pngTempDir);
if ($this->date != 'shopnc') {
// user data
if ($this->pngTempName != '') {
$filename = $this->pngTempDir.$this->pngTempName;
} else {
$filename = $this->pngTempDir.'test'.md5($this->date.'|'.$this->errorCorrectionLevel.'|'.$this->matrixPointSize).'.png';
}
QRcode::png($this->date, $filename, $this->errorCorrectionLevel, $this->matrixPointSize, 2);
} else {
//default data
QRcode::png('http://www.ejiao2o.com', $filename, $this->errorCorrectionLevel, $this->matrixPointSize, 2);
}
//display generated file
return basename($filename);
QRtools::timeBenchmark();
}
开发者ID:noikiy,项目名称:ejia,代码行数:27,代码来源:index.php
示例13: execute
/**
* function description
*
* @param
* @return void
*/
public function execute($request)
{
$id = $request->id;
if (empty($id)) {
header("Location: " . SP_URL_HOME);
exit;
}
$data = Sp_Account_Attendee::getAttendeeBySn($id);
if (empty($data)) {
header("Location: " . SP_URL_HOME);
exit;
}
if ($request->type == 'code') {
include LIB_ROOT . 'third/phpqrcode/qrlib.php';
$errorCorrectionLevel = "L";
$matrixPointSize = "6";
QRcode::png($id, false, $errorCorrectionLevel, $matrixPointSize);
} else {
$active = Sp_Active_Active::getActiveById($data['activeId']);
if (empty($active)) {
$this->show404();
}
$data['sn'] = $this->formatSn($data['signId']);
$view = new Sp_View();
$view->assign('data', $data);
$view->assign('active', $active);
$view->display("attendee/code.html");
}
}
开发者ID:ahmatjan,项目名称:Scene-Editor-for-mobile,代码行数:35,代码来源:Code.php
示例14: build
public function build($text, $prefix, $token, $args = array())
{
$matrixPointSize = 5;
$targetFolder = $this->png_dir . $token . '/d2/';
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir)) {
mkdir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir);
}
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token)) {
mkdir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token);
}
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token . '/d2/')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token . '/d2/');
}
$filename = 'qr_' . $prefix . '_' . $matrixPointSize . '_' . md5($text . '|' . $this->error_correction_level . '|' . $matrixPointSize . '|' . $token) . '.png';
$this->dest_url = $targetFolder . $filename;
Log::write('path:' . $this->dest_url);
if ($args) {
if (!isset($args['out_file'])) {
$args['out_file'] = $_SERVER['DOCUMENT_ROOT'] . $targetFolder . $filename;
}
create_qr($text, $args);
} else {
QRcode::png($text, $_SERVER['DOCUMENT_ROOT'] . $targetFolder . $filename, $this->error_correction_level, $matrixPointSize, 2);
}
}
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:25,代码来源:QRCodeGenerator.class.php
示例15: qrcode
public function qrcode()
{
import('Com.Wxpay.example.phpqrcode.phpqrcode', LIB_PATH, '.php');
$url = base64_decode($_GET["data"]);
\QRcode::png($url, false, QR_ECLEVEL_L, 9, 2);
exit;
}
开发者ID:bjjfsd,项目名称:youweihui,代码行数:7,代码来源:IndexController.class.php
示例16: action_generate
public function action_generate()
{
$basePath = DOCROOT;
$embedLogo = true;
$logoFilePath = "{$basePath}uploads/tmp/qrcode/logo.png";
//二维码内容
$content = \Input::get('content', '');
//保存路径
$savePath = 'uploads/tmp/qrcode/';
//容错级别(L | M | Q | H)
$errLevel = 0;
//二维码尺寸(1 ~ 10)
$size = 10;
//空白边距
$margin = 2;
$name = time();
$qrFilePath = "{$basePath}{$savePath}{$name}.png";
\QRcode::png($content, $qrFilePath, $errLevel, $size, $margin);
$QRFile = imagecreatefromstring(file_get_contents($qrFilePath));
// 是否嵌入Logo
if ($embedLogo) {
$this->embedLogo($QRFile, $logoFilePath);
}
//保存为图片
//imagepng($QRFile, $qrFilePath);
//输出图片流
imagepng($QRFile);
}
开发者ID:wxl2012,项目名称:wx,代码行数:28,代码来源:qrcode.php
示例17: createImg
public static function createImg($content, $qrc_level = 'H', $qrc_size = 10, $logo = FALSE, $savePath = null)
{
include_once 'phpqrcode.php';
// if($savePath)
$QR = QRcode::png($content, $savePath, $qrc_level, $qrc_size, 2);
if ($logo !== FALSE) {
$QR = imagecreatefromstring(file_get_contents($savePath));
$logo = imagecreatefromstring(file_get_contents($logo));
$QR_width = imagesx($QR);
// 二维码图片宽度
$QR_height = imagesy($QR);
// 二维码图片高度
$logo_width = imagesx($logo);
// logo图片宽度
$logo_height = imagesy($logo);
// logo图片高度
$logo_qr_width = $QR_width / 5;
$scale = $logo_width / $logo_qr_width;
$logo_qr_height = $logo_height / $scale;
$from_width = ($QR_width - $logo_qr_width) / 2;
// 重新组合图片并调整大小
imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
}
return $QR;
}
开发者ID:976112643,项目名称:manor,代码行数:25,代码来源:Qrcutils.php
示例18: QRcode
public function QRcode()
{
include "./weimicms/Lib/ORG/phpqrcode.php";
$viewUrl = C("site_url") . U("Wap/Index/index", array("token" => $this->token));
$url = urldecode($viewUrl);
QRcode::png($url, false, 0, 8);
}
开发者ID:liuguogen,项目名称:weixin,代码行数:7,代码来源:TmplsAction.class.php
示例19: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
global $_W;
if (!empty($rid)) {
$reply = pdo_fetch("SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
if (empty($reply['qrcode'])) {
if ($reply['qrtype'] == 0) {
$value = $_W['siteroot'] . 'app/' . $this->createmobileurl('sign', array('rid' => $rid));
$errorCorrectionLevel = 'H';
$matrixPointSize = '16';
$rand_file = rand() . '.png';
$att_target_file = 'qr-' . $rand_file;
$target_file = '../addons/bm_qrsign/tmppic/' . $att_target_file;
QRcode::png($value, $target_file, $errorCorrectionLevel, $matrixPointSize);
$reply['qrcode'] = $target_file;
} else {
$value = $_W['siteroot'] . 'app/' . $this->createmobileurl('pay', array('rid' => $rid));
$errorCorrectionLevel = 'H';
$matrixPointSize = '16';
$rand_file = rand() . '.png';
$att_target_file = 'qr-' . $rand_file;
$target_file = '../addons/bm_qrsign/tmppic/' . $att_target_file;
QRcode::png($value, $target_file, $errorCorrectionLevel, $matrixPointSize);
$reply['qrcode'] = $target_file;
}
}
}
load()->func('tpl');
include $this->template('form');
}
开发者ID:aspnmy,项目名称:weizan,代码行数:30,代码来源:module.php
示例20: generateQRCode
/**
* 生成QRCode
*/
function generateQRCode($itemProduct)
{
//在这里要确保 products文件夹中apk名字 与 数据库名字一样
$qrCodeHref = DOMAIN . '/products' . '/' . $itemProduct['download'];
define('QR_NAME', 'itemQRCode.png');
QRcode::png($qrCodeHref, QR_NAME, 'L', 5.5);
}
开发者ID:Ferrair,项目名称:MyPage,代码行数:10,代码来源:item_product.php
注:本文中的QRcode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论