本人小菜鸟一只,为了自我学习和交流PHP(jquery,linux,lamp,shell,javascript,服务器)等一系列的知识,小菜鸟创建了一个群。希望光临本博客的人可以进来交流。寻求共同发展。搭建平台。本人博客也有许多的技术文档,希望可以为你提供一些帮助。
QQ群: 191848169
require_once
(
'./Validator.class.php'
);
$data
=
array
(
'nickname'
=>
'heno'
,
'realname'
=>
'steven'
,
'age'
=> 25,
'mobile'
=>
'1521060426'
);
$validator
=
new
Validator(
$data
);
$validator
->setRule(
'nickname'
,
'required'
);
$validator
->setRule(
'realname'
,
array
(
'length'
=>
array
(1,6),
'required'
));
$validator
->setRule(
'age'
,
array
(
'required'
,
'digit'
));
$validator
->setRule(
'mobile'
,
array
(
'mobile'
));
$result
=
$validator
->validate();
var_dump(
$result
);
var_dump(
$validator
->getResultInfo());
本人小菜鸟一只,为了自我学习和交流PHP(jquery,linux,lamp,shell,javascript,服务器)等一系列的知识,小菜鸟创建了一个群。希望光临本博客的人可以进来交流。寻求共同发展。搭建平台。本人博客也有许多的技术文档,希望可以为你提供一些帮助。
QQ群: 191848169
require_once
(
'./Validator.class.php'
);
$data
=
array
(
'nickname'
=>
'heno'
,
'realname'
=>
'steven'
,
'age'
=> 25,
'mobile'
=>
'1521060426'
);
$validator
=
new
Validator(
$data
);
$validator
->setRule(
'nickname'
,
'required'
);
$validator
->setRule(
'realname'
,
array
(
'length'
=>
array
(1,6),
'required'
));
$validator
->setRule(
'age'
,
array
(
'required'
,
'digit'
));
$validator
->setRule(
'mobile'
,
array
(
'mobile'
));
$result
=
$validator
->validate();
var_dump(
$result
);
var_dump(
$validator
->getResultInfo());