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

验证数据的长度

WBOY
WBOYOriginal
2016-06-07 11:45:502183browse

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

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

Statement:
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