mirror of
https://gitee.com/fastadminnet/think-captcha.git
synced 2026-07-01 14:02:47 +08:00
增加支持验证码图片点击自动更换
这算是一个比较常用的需求了
This commit is contained in:
@@ -50,6 +50,19 @@ function captcha_img($id = '')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $element 验证码HTML元素ID
|
||||
* @return string
|
||||
*/
|
||||
function captcha_img_with_replacement($id = '', $element = 'think-captcha')
|
||||
{
|
||||
return '<img src="' . captcha_src($id) . '" alt="' . $element .
|
||||
'" id="think-captcha" onclick="document.getElementById("' . $element . '").src="' .
|
||||
captcha_src($id) . '"+Math.random()' . '/>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param string $id
|
||||
|
||||
Reference in New Issue
Block a user