 |
PHP - ทำ QR CODE ค่าไม่ดึงอ่ะครับ PHP QR Code encoder |
|
 |
|
|
 |
 |
|
ผมลอง สร้างตัวแปร์มา เป็น $PIC = 1234;
พอมาใส่ในรูปแบบนี้
QRcode::png ('$pic' ,$filename, $errorCorrectionLevel, $matrixPointSize, 2);
/* QRcode::png('$test');*/
เวลาสแกน QR CODE ทำงานครับ แต่ได้ค่าเป็น $PIC ไม่ได้ค่า 1234
รบกวนช่วยแนะนำด้วยครับ
Code (PHP)
<center>
<?php
$pis = 1234;
?>
<?php
/*
* PHP QR Code encoder
*
* Exemplatory usage
*
* PHP QR Code is distributed under LGPL 3
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*echo "<h1>PHP QR Code</h1><hr/>";*/
//set it to writable location, a place for temp generated PNG files
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
//html PNG location prefix
$PNG_WEB_DIR = 'temp/';
include "qrlib.php";
//ofcourse we need rights to create temp dir
if (!file_exists($PNG_TEMP_DIR))
mkdir($PNG_TEMP_DIR);
$filename = $PNG_TEMP_DIR.'test.png';
//processing form input
//remember to sanitize user input in real-life solution !!!
$errorCorrectionLevel = 'H';
if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
$errorCorrectionLevel = $_REQUEST['level'];
$matrixPointSize = 4;
if (isset($_REQUEST['size']))
$matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
if (isset($_REQUEST['data'])) {
//it's very important!
if (trim($_REQUEST['data']) == '')
die('data cannot be empty! <a href="?">back</a>');
// user data
$filename = $PNG_TEMP_DIR.''.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
QRcode::png($_REQUEST[''], $filename, $errorCorrectionLevel, $matrixPointSize, 2);
} else {
//default data
/*echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>'; */
QRcode::png ('$pic' ,$filename, $errorCorrectionLevel, $matrixPointSize, 2);
/* QRcode::png('$test');*/
}
//display generated file
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
Tag : PHP, Ms SQL Server 2008
|
|
 |
 |
 |
 |
Date :
2017-08-18 11:48:41 |
By :
pissanu8970 |
View :
1657 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้ล่ะครับ
QRcode::png ($pic ,$filename, $errorCorrectionLevel, $matrixPointSize, 2);
ต้องใส่ประมาณนี้ ไม่ต้อง มี '...'
ยังไงก็ต้องขอบคุณครับ
|
 |
 |
 |
 |
Date :
2017-08-18 13:43:11 |
By :
pissanu8970 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2017-08-20 05:36:24 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|