我有base64数据在http://pastebin.com/TZUeECM3中
如何将其base64转换为jpg或png并保存在文件夹中。这是我的密码
$filename_path = md5(time().uniqid()).".jpg";
$decoded=base64_decode($base64_string);
file_put_contents("uploads/".$filename_path,$decoded);发布于 2016-08-04 11:55:28
包含"data:image/png;base64"的base64代码只需删除它,然后尝试解码,即使它不能工作,然后用"+"和decode替换空格
$filename_path = md5(time().uniqid()).".jpg";
$base64_string = str_replace('data:image/png;base64,', '', $base64_string);
$base64_string = str_replace(' ', '+', $base64_string);
$decoded = base64_decode($base64_string);
file_put_contents("uploads/".$filename_path,$decoded);https://stackoverflow.com/questions/38766050
复制相似问题