1.0.0 • Published 2 years ago
svg-captcha-random v1.0.0
下载
npm i svg-captcha-random -s
使用
const captcha = require('svg-captcha-random')
let temp = captcha.create()
console.log(temp) // {text:'D3DS', data: '<svg></svg>'}
结合http模块
const http = require('http')
const captcha = require('svg-captcha-random')
http.createServer((req, res) => {
res.setHeader('content-type', 'text/html;charset=utf-8')
let temp = captcha.create(200,100,'aqua',40,20,25,'pink')
//参数一:验证码框宽,参数二:验证码框高,'参数三:验证码框背景颜色',参数四:字体大小,参数五:x轴起点,参数六:y轴起点,参数七:验证码字体颜色
res.end(temp.data)
}).listen(3000, () => {
console.log('启动成功, 访问 http://localhost:3000');
})
1.0.0
2 years ago