留言功能启用验证码可以避免一些垃圾信息,开启方法也很简单,下载验证码管理插件,或者更改配置文件。但是使用中发现留言后验证码失效,每次失效都要刷回页面,这样好不容易填写好的内容必须重新填写很是麻烦,总结了以下改进方法。

1.开启留言: 找到application/config.php 把 'guestbook'设置为1即为开启

2.使用验证码 在模版页面留言表单加入

{eq name="$field2.IsVertify" value="1"}
<p class="contactform_code">
	<input type="text" class="inputtxt" name="vertify" size="4" placeholder="验证码" autocomplete="off" style="width: 180px;">
	<img {$field2.VertifyData} style="height: 60px;">
</p>
{/eq}

3.优化验证码错误 原因是地址没加token,找到 core/library/think/template/taglib/eyou/TagGuestbookform.php 查询ey_fleshVerify方法,在地址var src =中&type=guestbook后面加&token=token{$token_id}