您能否指导我如何将图像从URL转换为base64编码?
我认为应该是:
$path = 'myfolder/myimage.png'; $type = pathinfo($path, PATHINFO_EXTENSION); $data = file_get_contents($path); $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);