public function index() { import('QRCode'); $QRCode = new QRCode('', 150); $img_url = $QRCode->getUrl("http://blog.51edm.org"); echo '<img src="' . $img_url . '" />'; }
protected function getQRCode($url = NULL) { if (IS_POST) { $this->assign("QRcodeUrl", ""); } else { // $url = empty($url) ? C('WEB_ROOT') . $_SERVER['REQUEST_URI'] : $url; $url = empty($url) ? C('WEB_ROOT') . U(MODULE_NAME . '/' . ACTION_NAME) : $url; import('QRCode'); $QRCode = new QRCode('', 80); $QRCodeUrl = $QRCode->getUrl($url); $this->assign("QRcodeUrl", $QRCodeUrl); } }