/** * 保存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','参数错误'); }}