增加支持验证码图片点击自动更换

这算是一个比较常用的需求了
This commit is contained in:
changwei
2018-06-07 02:38:39 +08:00
parent 9572406f5e
commit 2a10155772

View File

@@ -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