thinkphp6 保存base64图片
2023-03-29 23:03:03
208
{{single.collect_count}}
/** * 保存base64文件 * @param FJ_img base64文件 */public function SaveImg(XhyRequest $request){$data = $request->param();if(!empty($data['FJ_img'])){$reg = '/data:image\/(\w+?);base64,(.+)$/si';preg_match($reg,$data['FJ_img'],$match_result);var_dump($match_result);die;$file_name = time().'.'.$match_result[1]; $logo_path = 'uploadimg/'.$file_name;$num = file_put_contents($logo_path,base64_decode($match_result[2]));if(!empty($num)){ $img['img_url']=addhttp($_SERVER['HTTP_HOST'].'/'.$logo_path);outJson('200','保存成功',$img); }else{outJson('401','保存失败'); } }else{outJson('403','参数错误'); }}
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}