本文共 336 字,大约阅读时间需要 1 分钟。
/** * 网络图转base64编码 * @param img 图片网址 **/public function imgToBase64($img = ''){ if (!$img) { return false; } $imageInfo = getimagesize($img); $base64 = "" . chunk_split(base64_encode(file_get_contents($img))); return 'data:' . $imageInfo['mime'] . ';base64,' . chunk_split(base64_encode(file_get_contents($img)));}
转载地址:http://zlhrn.baihongyu.com/