TP5 base64图片上传

TP5 base64图片上传

function base64Image(KaTeX parse error: Expected '}', got 'EOF' at end of input: … if (!empty(imgString) && preg_match(’/^(data:\s*image/(\w+);base64,)/’, $imgString, $result)) {
$ext = $result[2];
//生成当天日期字符串
$today = date(‘Ymd’, time());
//文件上传目录
$upload_path = ‘uploads/’ . $today;
$upload_path = ‘uploads/’ . t o d a y ; i f ( ! f i l e e x i s t s ( today; if (!file_exists( upload_path)) {
mkdir($upload_path, 0777,true);
}
//文件路径名
$filename = uniqid() . ‘.’ . e x t ; i f ( f i l e p u t c o n t e n t s ( ext; if (file_put_contents( upload_path . ‘/’ . f i l e n a m e , b a s e 6 4 d e c o d e ( s t r r e p l a c e ( filename, base64_decode(str_replace( result[1], ‘’, KaTeX parse error: Expected '}', got 'EOF' at end of input: … return '/'.upload_path . ‘/’ . $filename;
} else {
return ‘’;
}
}
return ‘’;
}

猜你喜欢

转载自blog.csdn.net/Error_Q/article/details/89458772