生成二维码

admin2年前Laravel790

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;
}

返回列表

上一篇:用户注册账号

下一篇:修改密码

相关文章

laravel 加cache锁

use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Cache; $lock = Ca...

获取微信的Token

 public function Token()    {        $this->path = __DIR__ . &...

两个经纬度之间的距离

    public function haversineGreatCircleDistance($latitude1, $longitude1, $latitude2, $lon...

抖音小程序码

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

设置项目编号

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

微信开放平台-扫码登录

public function wx_info(){    $code = request()->input('code');    if...