0
点赞
收藏
分享

微信扫一扫

二进制图片文件流生成图片并保存

南柯Taylor 2022-03-17 阅读 34
php
        $token = $this->getWxToken();
        $url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$token";
        $data = [
            'path' => 'pages/index/detail?id=2057'
        ];
        $result = httpsCurl($url, json_encode($data), 'POST');

        $path = ROOT_PATH. 'public' . DS .'uploads'. DS;
        $filename= time().'.png';

        $filePath = $path . $filename;
        if(!file_exists($filePath)) {
            touch($filePath);
        }
        $file = fopen($filePath,"w+");//打开文件准备写入
        fwrite($file,$result);//写入
        fclose($file);//关闭
举报

相关推荐

0 条评论