PHP将图片流存为图片文件
//网签生成图片 if (empty($data[‘signature‘])) { return $result = [‘code‘ => 0, ‘msg‘ => ‘请签名后再提交!‘]; } //将图片流写入图片文件 $file_path = ROOT_PATH.‘public_html/uploads/signature‘; if (!file_exists($file_path)){ mkdir($file_path); } $file_name = $this->c_user_id.‘.png‘; $file = $file_path . ‘/‘ . $file_name; if (file_exists($file)) { unlink($file); } $image = file_get_contents ( $data[‘signature‘]); if (@$fp = fopen ( $file, ‘w+‘ )) { fwrite ( $fp, $image ); fclose ( $fp ); }
PHP将图片流存为图片文件
原文:https://www.cnblogs.com/Strive-count/p/15270615.html