本文实例讲述了php实现将base64格式图片保存在指定目录的方法。分享给大家供大家参考,具体如下: <?php header('Content-type:text/html;charset=utf-8'); $base64_image_content = $_POST['imgBase64']; //匹配出图片的格式 if (preg_match('/^([removed])/', $base64_image_content, $result)){ $type = $result[2]; $new_file = upload/active/img/