function qr_node($url, $sspass, $port, $method = 'aes-256-cfb') { $url = $method . ":{$sspass}@" . $url . ":{$port}"; $url = "ss://" . base64_encode($url); $qrCode = new QrCode(); $qrCode->setText($url); $qrCode->setSize(140); $qrCode->setPadding(5); $img = $qrCode->getDataUri(); return $img; }
function render($text, $size = 200) { $qrCode = new QrCode(); $qrCode->setText($text); $qrCode->setSize($size); return $qrCode->getDataUri($text); }
/** * process the blocktrail public keys and create qr codes for each one */ protected function processBlocktrailPubKeys() { //create QR codes for each blocktrail pub key foreach ($this->blocktrailPublicKeys as $keyIndex => $key) { $qrCode = new QrCode(); $qrCode->setText($key->key())->setSize(self::QR_CODE_SIZE - 20)->setPadding(10)->setErrorCorrection('high')->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))->setLabel("KeyIndex: " . $keyIndex . " Path: " . $key->path())->setLabelFontSize(10); $this->blocktrailPubKeyQRs[] = array('keyIndex' => $keyIndex, 'path' => $key->path(), 'qr' => $qrCode->getDataUri(), 'qrImg' => $qrCode->getImage()); } }
function qr_node($sspass, $port) { $url = "rc4-md5:{$sspass}@jp01.playss.me:{$port}"; $url = "ss://" . base64_encode($url); $qrCode = new QrCode(); $qrCode->setText($url); $qrCode->setSize(140); $qrCode->setPadding(5); $img = $qrCode->getDataUri(); return $img; }
$that->addParams('key', MCHKEY); }); $params['sign'] = $signGenerator->getResult(); $links = 'weixin://wxpay/bizpayurl?' . http_build_query($params); /** * 生成支付二维码 * See https://github.com/endroid/QrCode */ $qrCode = new QrCode(); $qrCode->setText($links)->setSize(200)->setPadding(10)->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0)); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>Wechat SDK</title> </head> <body ontouchstart=""> <h1>扫描支付模式一</h1> <img src="<?php echo $qrCode->getDataUri(); ?> " style="border:1px solid #ccc;" /> </script> </body> </html>
<?php /* * (c) Jeroen van den Enden <*****@*****.**> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Endroid\Tests\QrCode; include 'Endroid/QrCode/QrCode.php'; use Endroid\QrCode\QrCode; $qrCode = new QrCode(); $qrCode->setText("Life is too short to be generating QR codes"); $qrCode->setSize(150); $qrCode->setPadding(10); echo "<img src='{$qrCode->getDataUri()}'>";
public function qrCodeAction($person) { /** @var VCardService $vCardService */ $vCardService = $this->get('corporate_v_cards.vcard'); // Get profile $profile = $vCardService->getProfile($person); if (!$profile) { throw new NotFoundHttpException(); } // Get vCard $vcard = $vCardService->getVcard($profile, false); // Build qrCode $qrCode = new QrCode(); $qrCode->setText($vcard->getOutput())->create(); // Build response $response = new StreamedResponse(function () use($qrCode) { $base64_uri = $qrCode->getDataUri(); echo base64_decode(substr($base64_uri, strlen("data:image/png;base64,"))); }); $response->headers->set('Content-Type', 'image/png'); return $response; }
/** * Generate the QrCode * * @param $uri * @param $size * @param $binary * * @return mixed * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException */ protected function generateQrCode($uri, $size, $binary) { $qrCode = new QrCode(); $qrCode->setText($uri); $qrCode->setSize($size); $qrCode->setPadding(0); return $binary ? $qrCode->get() : $qrCode->getDataUri(); }
/** * Creates the QR code data corresponding to the given message. * * @param $text * @param int $size * @param int $padding * @param string $extension * @param mixed $errorCorrectionLevel * @param array $foregroundColor * @param array $backgroundColor * @param string $label * @param string $labelFontSize * @param string $labelFontPath * * @return string */ public function qrcodeDataUriFunction($text, $size = null, $padding = null, $extension = null, $errorCorrectionLevel = null, array $foregroundColor = null, array $backgroundColor = null, $label = null, $labelFontSize = null, $labelFontPath = null) { if ($size === null && $this->container->hasParameter('endroid_qrcode.size')) { $size = $this->container->getParameter('endroid_qrcode.size'); } if ($padding === null && $this->container->hasParameter('endroid_qrcode.padding')) { $padding = $this->container->getParameter('endroid_qrcode.padding'); } if ($extension === null && $this->container->hasParameter('endroid_qrcode.extension')) { $extension = $this->container->getParameter('endroid_qrcode.extension'); } if ($errorCorrectionLevel === null && $this->container->hasParameter('endroid_qrcode.error_correction_level')) { $errorCorrectionLevel = $this->container->getParameter('endroid_qrcode.error_correction_level'); } if ($foregroundColor === null && $this->container->hasParameter('endroid_qrcode.foreground_color')) { $foregroundColor = $this->container->getParameter('endroid_qrcode.foreground_color'); } if ($backgroundColor === null && $this->container->hasParameter('endroid_qrcode.background_color')) { $backgroundColor = $this->container->getParameter('endroid_qrcode.background_color'); } if ($label === null && $this->container->hasParameter('endroid_qrcode.label')) { $label = $this->container->getParameter('endroid_qrcode.label'); } if ($labelFontSize === null && $this->container->hasParameter('endroid_qrcode.label_font_size')) { $labelFontSize = $this->container->getParameter('endroid_qrcode.label_font_size'); } if ($labelFontPath === null && $this->container->hasParameter('endroid_qrcode.label_font_path')) { $labelFontPath = $this->container->getParameter('endroid_qrcode.label_font_path'); } $qrCode = new QrCode(); $qrCode->setText($text); if ($size !== null) { $qrCode->setSize($size); } if ($padding !== null) { $qrCode->setPadding($padding); } if ($extension !== null) { $qrCode->setExtension($extension); } if ($errorCorrectionLevel !== null) { $qrCode->setErrorCorrection($errorCorrectionLevel); } if ($foregroundColor !== null) { $qrCode->setForegroundColor($foregroundColor); } if ($backgroundColor !== null) { $qrCode->setBackgroundColor($backgroundColor); } if ($label != null) { $qrCode->setLabel($label); } if ($labelFontSize != null) { $qrCode->setLabelFontSize($labelFontSize); } if ($labelFontPath != null) { $qrCode->setLabelFontPath($labelFontPath); } return $qrCode->getDataUri(); }
$msg = 0; $msgtype = 0; $url = "rc4-md5:{$sspass}@sfo.404notfound.cc:{$port}"; $url = "ss://" . base64_encode($url); $qrCode = new QrCode(); $qrCode->setText($url); $qrCode->setSize(140); $qrCode->setPadding(5); $sfoimg = "<img src='{$qrCode->getDataUri()}' >"; $url = "aes-256-cfb:{$sspass}@hk.404notfound.cc:{$port}"; $url = "ss://" . base64_encode($url); $qrCode = new QrCode(); $qrCode->setText($url); $qrCode->setSize(140); $qrCode->setPadding(5); $hkimg = "<img src='{$qrCode->getDataUri()}' >"; ?> <div role="tabpanel"> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <?php //不会写函数的渣渣 //权限控制 根据level显示不同的节点信息 if ($lv == 1) { echo '<li role="presentation" class="active"><a href="#sfo" aria-controls="sfo" role="tab" data-toggle="tab">旧金山</a></li>'; echo '<li role="presentation"><a href="#hk" aria-controls="profile" role="tab" data-toggle="tab">香港</a></li>'; } elseif ($lv = 4) { echo '<li role="presentation"><a href="#hk" aria-controls="profile" role="tab" data-toggle="tab">香港</a></li>'; }