svg_captcha_dxy
Version:
svg随机验证码
36 lines (26 loc) • 712 B
Markdown
# ⭐️ 随机验证码 - 下载
```
npm i svg_captcha_dxy -S
```
# 🌰 随机验证码 - 使用
```
const captcha = require('svg_captcha_dxy')
let temp = captcha.create({
num:3,
color:true,
noise:3
})
console.log(temp) // {text:'D3DS', data: '<svg></svg>'}
```
# 🌰 随机验证码 - 结合HTTP模块
```
const http = require('http')
const captcha = require('svg_captcha_dxy')
http.createServer((req, res) => {
res.setHeader('content-type', 'text/html;charset=utf-8')
let temp = captcha.create({num:4,color:false,noise:4})
res.end(temp.data)
}).listen(3000, () => {
console.log('启动成功, 访问 http://localhost:3000');
})
```