后端控制器代码为 public function upload(){
$base64 = I('post.str');
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64, $result)){
$type = $result[2];
$new_file = "./Uploads/".time().".{$type}";
if (file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64)))){
echo '新文件保存成功:', $new_file;
}
}
}
JS插件请到github下载https://github.com/baijunjie/jQuery-photoClip AD:真正免费,域名+虚机+企业邮箱=0元
已抢186675个
抢已抢67315个
抢已抢353132个
抢已抢667392个
抢已抢122568个
抢已抢24067个
抢