コード例 #1
0
ファイル: JsController.class.php プロジェクト: ircoco/qrcode
 public function index()
 {
     $qrcode_width = intval($_GET['qw']);
     $qrcode_height = intval($_GET['qh']);
     $qrcode_type = trim($_GET['qt']);
     $qrcode_content = trim($_GET['qc']);
     $qrcode_logo = trim($_GET['ql']);
     $hash = md5($qrcode_content . $qrcode_width . $qrcode_height . $qrcode_type . $qrcode_logo);
     $map = array('hash' => $hash);
     $one = D('qrcode')->field('file_path')->where($map)->find();
     if ($one) {
         $qrcode_file = $one['file_path'];
     } else {
         $file_dir = 'Uploads/' . date('Y') . '/' . date('m') . '/' . date('d');
         mkdirs($file_dir);
         $qrcode_file = $file_dir . '/' . $hash . '.png';
     }
     //$qrcode_content = htmlspecialchars_decode($qrcode_content);
     if (!$one) {
         qrcode($qrcode_file, $qrcode_content, $qrcode_logo, $qrcode_width, $qrcode_height, $qrcode_type);
         //保存到数据库
         $data = array('hash' => $hash, 'width' => $qrcode_width, 'height' => $qrcode_height, 'logo' => $qrcode_logo, 'content' => $qrcode_content, 'file_path' => $qrcode_file, 'dateline' => time());
         D('qrcode')->add($data);
     }
     $qrcode_url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $qrcode_file;
     //qrcode
     $qrcode_href = 'http://' . $_SERVER['HTTP_HOST'] . '/qr.html?hash=' . $hash;
     $this->assign('qrcode_width', $qrcode_width);
     $this->assign('qrcode_height', $qrcode_height);
     $this->assign('qrcode_url', $qrcode_url);
     $this->assign('qrcode_href', $qrcode_href);
     $this->display();
 }
コード例 #2
0
 public function tcode()
 {
     $uid = I('uid');
     $data = 'http://www.1dian.la/reg?s=' . $uid . '&type=home';
     qrcode($data);
 }
コード例 #3
0
ファイル: qr.php プロジェクト: xiaobai557/moefm-html5-project
<?php

header("Content-type:image/png");
$width = 180;
$height = 180;
$data = $_GET['data'];
echo qrcode($width, $height, $data);
function qrcode($width, $height, $string)
{
    $post_data = array();
    $post_data['cht'] = 'qr';
    $post_data['chs'] = $width . "x" . $height;
    $post_data['chl'] = $string;
    $post_data['choe'] = "UTF-8";
    $url = "http://chart.apis.google.com/chart";
    $data_Array = array();
    foreach ($post_data as $key => $value) {
        $data_Array[] = $key . '=' . $value;
    }
    $data = implode("&", $data_Array);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    //echo "<img src =\"data:image/png;base64,".base64_encode($result)."\" >"; 注意,不写header的写法
    return $result;
}
コード例 #4
0
echo $cid;
?>
&id=<?php 
echo $id;
?>
" target="_blank" onclick="download_count(<?php 
echo $cid;
?>
,<?php 
echo $id;
?>
);"><button type="button" class="btn btn-danger">点击下载</button></a>
                </div>
                <hr>
                <div class="content_p" onmousemove="show_qrcode('img2','<?php 
echo qrcode($downfile);
?>
')">
                    手机扫描下载:<!--<img src="<?php 
echo R;
?>
images/icon/qr_code.png" >-->
                    <img id="img2" src="<?php 
echo R;
?>
images/icon/qr_code.png" style=" position:relative; left:0px;" >
                </div>

                <?php 
if ($content_pages) {
    ?>
コード例 #5
0
ファイル: ApiAction.class.php プロジェクト: xibaachao/1bz
 /**
  * 关注
  * @access public
  * @param array $info 用户信息
  * @return void
  */
 function subscribe_handler($info)
 {
     $access_token = get_access_token();
     $openid = (string) $info['from'];
     $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$access_token}&openid={$openid}";
     $data = json_decode(file_get_contents($url), true);
     $count = D("Account")->where("openid='{$openid}'")->count();
     if ($count >= 1) {
         return false;
     }
     $data['time'] = time();
     $data['openid'] = $openid;
     $data['no'] = '61308818' . date('YmdHis') . rand(0, 9);
     $data['sum'] = $data['fill'] = $data['handsel'] = 0;
     $uid = D("Account")->add($data);
     import("ORG.Net.Http");
     $qrcode = qrcode(U("Admin/Account/show", array("id" => $uid), true, false, true));
     file_put_contents("./Public/qrcode/" . $data['no'] . '.jpg', Http::fsockopenDownload($qrcode));
     //Http::curlDownload($qrcode, './Public/qrcode/'.$data['no'].'.jpg');
 }