//网签生成图片 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 ); }