phpbase64上传图片

                     $ymd = date("Ymdhis");
        //图片路径地址
        $img = str_replace('data:image/png;base64,', '', $img);
        $img = str_replace(' ', '+', $img);
        $data = base64_decode($img);

        $imgPath='./upload/person/'.$ymd.'jpg';
        $fp=fopen($imgPath,'w');
        fwrite($fp,$data);
        fclose($fp);
        $ary['status'] = 1;
        $ary['info'] = '保存图片成功';
        $ary['url'] = $imgPath;

        return $ary;

分享名称:phpbase64上传图片
转载源于:http://scyanting.com/article/igdhje.html