mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update CaptchaService.php
This commit is contained in:
parent
7bb7404960
commit
f678fece61
@ -67,12 +67,12 @@ class CaptchaService
|
|||||||
$this->img = imagecreatetruecolor($this->width, $this->height);
|
$this->img = imagecreatetruecolor($this->width, $this->height);
|
||||||
$color = imagecolorallocate($this->img, mt_rand(220, 255), mt_rand(220, 255), mt_rand(220, 255));
|
$color = imagecolorallocate($this->img, mt_rand(220, 255), mt_rand(220, 255), mt_rand(220, 255));
|
||||||
imagefilledrectangle($this->img, 0, $this->height, $this->width, 0, $color);
|
imagefilledrectangle($this->img, 0, $this->height, $this->width, 0, $color);
|
||||||
// 线条
|
// 生成线条
|
||||||
for ($i = 0; $i < 6; $i++) {
|
for ($i = 0; $i < 6; $i++) {
|
||||||
$color = imagecolorallocate($this->img, mt_rand(0, 50), mt_rand(0, 50), mt_rand(0, 50));
|
$color = imagecolorallocate($this->img, mt_rand(0, 50), mt_rand(0, 50), mt_rand(0, 50));
|
||||||
imageline($this->img, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $color);
|
imageline($this->img, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $color);
|
||||||
}
|
}
|
||||||
// 雪花
|
// 生成雪花
|
||||||
for ($i = 0; $i < 100; $i++) {
|
for ($i = 0; $i < 100; $i++) {
|
||||||
$color = imagecolorallocate($this->img, mt_rand(200, 255), mt_rand(200, 255), mt_rand(200, 255));
|
$color = imagecolorallocate($this->img, mt_rand(200, 255), mt_rand(200, 255), mt_rand(200, 255));
|
||||||
imagestring($this->img, mt_rand(1, 5), mt_rand(0, $this->width), mt_rand(0, $this->height), '*', $color);
|
imagestring($this->img, mt_rand(1, 5), mt_rand(0, $this->width), mt_rand(0, $this->height), '*', $color);
|
||||||
@ -97,7 +97,11 @@ class CaptchaService
|
|||||||
*/
|
*/
|
||||||
public function getAttr()
|
public function getAttr()
|
||||||
{
|
{
|
||||||
return ['code' => $this->code, 'uniq' => $this->uniqid, 'data' => $this->getData()];
|
return [
|
||||||
|
'code' => $this->code,
|
||||||
|
'uniq' => $this->uniqid,
|
||||||
|
'data' => $this->getData()
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user