$img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $imgPath="test.png"; if(@file_exists($imgPath)){ @unlink($imgPath); }@clearstatcache(); $fp=fopen($imgPath,'w'); fwrite($fp,$data); fclose($fp);
转载于:https://my.oschina.net/AnnaWang/blog/1931725