Home > php教程 > php手册 > 验证数据的长度

验证数据的长度

WBOY
Release: 2016-06-07 11:45:50
Original
2243 people have browsed it

在ThinkPHP里面通过自动验证定义来验证数据的长度是否符合要求,在你的模型类里面添加下面的定义即可:
protected $_validate = array(<br>       array('title','5,100','标题长度不符!',3,'length'), // 验证标题长度<br>       array('phone','11','电话长度不符!',3,'length'), // 验证电话号码长度<br> );

AD:真正免费,域名+虚机+企业邮箱=0元

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template