生成二维码

admin1年前Laravel491

public function qrcode($uid)
{
   require_once base_path() . '/public/phpqrcode/phpqrcode.php';
   $imageName = "p_" . date("His", time()) . "_" . rand(1111, 9999) . '.jpg';
   $domain = $this->domain();
   $path = "upload/qrcode/" . date("Ymd");
   if (!is_dir($path)) { //判断目录是否存在 不存在就创建
       mkdir($path, 0777, true);
       chmod($path, 0777);
   }
   $msg = $uid;
   $msg1 = \QRcode::png($domain . '/h5?scene=' . $msg, $path . '/' . $imageName, 'L', 6, 5); // 生成二维码并保存为文件
   Db::table('member')->where(array('id' => $this->user_id))->update(['qrcode' => $path . '/' . $imageName]);
   return $path . '/' . $imageName;
}

返回列表

上一篇:用户注册账号

下一篇:修改密码

相关文章

设置项目编号

$max = Db::table('member')->max('id') ?? 0; if ($max < 100000) { $cd = $this->create...

用户注册账号

public function register(){    $mobile = request()->input('mobile');   &nb...

阿里云发送短信

public function sms(){    $moile = request()->input('mobile');    if...

关注公众号并登录

/* * 服务端生成带唯一标识二维码并将唯一标识返回给前端 */ public function wx_code() { $scene_str = $this->get_...

过滤违禁词

/** * 内容验证 */public function check($content){    $count = 0; //违规词的个数    $list =...

抖音小程序码

public function dyqrcode($uid){    $url = "https://open.douyin.com/api/apps/v1/qrcode...