Home > Backend Development > PHP Tutorial > thinkphp3.2.3 表单验证 unique出错

thinkphp3.2.3 表单验证 unique出错

WBOY
Release: 2016-06-13 12:25:33
Original
1106 people have browsed it

thinkphp3.2.3 表单验证 unique报错

<br />protected $_validate = array(<br />    // array(field,rule,message,condition,type,when,params)<br />        // 1 用户不能为空,唯一,至少4个字符<br />        array('username', '', '用户名已存在', 0, 'unique'),<br />    );<br />
Copy after login

在表单输入相同的名字 报SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '100' for key 'PRIMARY'
数据库相同的名字的位置,而不是输出错误信息。这是那里错了?

------解决思路----------------------
请贴出控制器里处理表单的代码

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template