前端img的src如果是base64,那么需要mime头的
后端php读取图片并加上mime头处理如下
function readPhotoToBase64($image_file)
{
//相对或绝对路径
$image_info = getimagesize($image_file);
$base64_content = "data:{$image_info['mime']};base64," . chunk_split(base64_encode(file_get_contents($image_file)));
return $base64_content;
}