PHP base64图片资源 转存为图片

版权声明: https://blog.csdn.net/BookNoteY/article/details/82771887

去掉base64的头然后 写入文件

preg_match('/^(data:\s*image\/(\w+);base64,)/',$aCurlData['imgUrl'], $result);

$type = $result[2];

echo $result[1];

if (file_put_contents('./temp1.jpg', base64_decode(str_replace($result[1], '', $aCurlData['imgUrl']))))

die;

猜你喜欢

转载自blog.csdn.net/BookNoteY/article/details/82771887