php 之 创建永久二维码

首先,我们需要下载 phpqrcode 库

地址:https://nchc.dl.sourceforge.net/project/phpqrcode/releases/phpqrcode-2010100721_1.1.4.zip

声明一下:使用的是 Yii 框架

传的参数则为需要写入二维码的内容,这里传了 id

public function createCode1($id) {
		
		$qrcode_path='';
		$file_tmp_name='';
		$errors=array();
		
		$content = $id; //二维码内容
		
		Yii::$enableIncludePath = false;
		Yii::import ('application.extensions.phpqrcode.phpqrcode', 1 );
		
		$tpgs='png';//图片格式
		//$bas_path=dirname ( Yii::app ()->BasePath );
		$qrcode_bas_path='/web/image/qrcode/';
		if(!is_dir($qrcode_bas_path)){
			mkdir($qrcode_bas_path, 0777, true);
		}
		$uniqid_rand=date("Ymdhis").uniqid(). rand(1,1000);
		$qrcode_path=$qrcod
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值