<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                需求: ????目前需要在一個頁面中加載使用很多image組件,加載圖片,采用的是\[data:image..base64,...\]格式的圖片直接放在src里.但在真機測試時,可以導致wxml里內容太多,小程序直接無響應.所以想著把 從服務端傳來的base64格式的圖片轉成本地文件路徑后,再放到image組件的src里. 解決: ????在社區里查了好多帖子,發現都是提此類問題,但均沒有結果.后來在網上找到了解決方法,現分享如下: ????var base64 = "data:image...";//base64格式圖片 ????var imgPath = wx.env.USER\_DATA\_PATH+'/頁面名稱'+'你的圖片名'+ '.png'; ????//如果圖片字符串不含要清空的前綴,可以不執行下行代碼. //var imageData = base64.replace(/^data:image\\/\\w+;base64,/, ""); var imageData\=qr\_code.replace(/^data:image\\/jpg\\/png\\/gif;base64,/,""); ????var fs = wx.getFileSystemManager(); ????fs.writeFileSync(imgPath, imageData, "base64"); ?至此就可以用imgPath(圖片的本地文件路徑)進行后繼大家想要的操作了! ?注意用完后,及時清理本地文件.釋放儲存空間. 最后:發現社區中已有此種解決方法了,之前沒找到. ~~~ /** * 獲取小程序二維碼 * @return mixed */ public function getMiniQRcode($page='pages/index/index',$scene='',$is_return_url=1) { $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$this->get_access_token(); $data['scene'] = $scene; $data['page'] = $page; $data['width'] = 280; $result = $this->requestURL($url,$data,'POST'); $result_code = json_decode($result,true); if (isset($result_code['errcode'])) { return $result_code; } $path = "./upload/miniapp_".mt_rand(0,1000)."_".microtime(true).".png"; $file = fopen($path,"w");//創建件準備寫入,文件名xcxcode/wxcode1.jpg為自定義 fwrite($file,$result);//寫入 if ($is_return_url) { return $path; } else { // unlink($path); // dd($scene); // header('Content-Type:image/jpg'); // exit($result); if($fp = fopen($path,"rb", 0)) { //這里是返回base64圖片 $gambar = fread($fp,filesize($path)); fclose($fp); $base64 = chunk_split(base64_encode($gambar)); unlink($path); // // 輸出 // $encode = '<img src="data:image/jpg/png/gif;base64,' . $base64 .'" >'; // echo $encode; // 輸出 return "data:image/jpg/png/gif;base64,". $base64; } } } ~~~ getQRcode () { let _this = this this.$http.get('/api/xxxxxxxxxxxxx/getMiniQRcode', {}).then((res) => { if (res) { // 后臺返回的base64圖片格式去掉空格和換行 let str = res.replace(/\. +/g, '') str = str.replace(/[\r\n]/g, '') _this.qrcode = str } else { console.log('圖片不存在') } }).catch(err => { console.log(err.status, err.message) }) }
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看