Validation
Validation
A simple but powerful Validation Engine, in a Laravel-esque style.
Its Validation Rules and the basic usage are similar with Illuminate\Validation v4.x, but no Files Validation support.
To note that it use the new Database API for verification of data presence into Database. Then, if you use this Validation, is a must to use also the new Database API in the entire application, and NOT the variant given by Helpers\Database.
Also to note that for the translation of error messages, it use the new Language API.
The Validation usage is simple, as in the following example:
use Validator;
$data = array(
'username' => 'michael',
'password' => 'password',
'email' => 'michael@novaframework.dev'
);
$rules = array(
'username' => 'required|min:3|max:50|alpha_dash|unique:users',
'password' => 'required|between:4,30',
'email' => 'required|email|max:100|unique:users',
);
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
echo '<h3>Data validated with success!</h3>';
echo '<pre>' .var_export($data, true) .'</pre>';
} else {
$errors = $validator->errors()->all();
echo '<pre>' .var_export($errors, true) .'</pre>';
}
Validation的更多相关文章
- jQuery学习之路(8)- 表单验证插件-Validation
▓▓▓▓▓▓ 大致介绍 jQuery Validate 插件为表单提供了强大的验证功能,让客户端表单验证变得更简单,同时提供了大量的定制选项,满足应用程序各种需求.该插件捆绑了一套有用的验证方法,包括 ...
- jQuery- 表单验证插件-Validation
▓▓▓▓▓▓ 大致介绍 jQuery Validate 插件为表单提供了强大的验证功能,让客户端表单验证变得更简单,同时提供了大量的定制选项,满足应用程序各种需求.该插件捆绑了一套有用的验证方法, ...
- 交叉验证(Cross Validation)原理小结
交叉验证是在机器学习建立模型和验证模型参数时常用的办法.交叉验证,顾名思义,就是重复的使用数据,把得到的样本数据进行切分,组合为不同的训练集和测试集,用训练集来训练模型,用测试集来评估模型预测的好坏. ...
- MVC学习系列13--验证系列之Remote Validation
大多数的开发者,可能会遇到这样的情况:当我们在创建用户之前,有必要去检查是否数据库中已经存在相同名字的用户.换句话说就是,我们要确保程序中,只有一个唯一的用户名,不能有重复的.相信大多数人都有不同的解 ...
- MVC学习系列12---验证系列之Fluent Validation
前面两篇文章学习到了,服务端验证,和客户端的验证,但大家有没有发现,这两种验证各自都有弊端,服务器端的验证,验证的逻辑和代码的逻辑混合在一起了,如果代码量很大的话,以后维护扩展起来,就不是很方便.而客 ...
- jQuery Validation Engine 表单验证
功能强大的 jQuery 表单验证插件,适用于日常的 E-mail.电话号码.网址等验证及 Ajax 验证,除自身拥有丰富的验证规则外,还可以添加自定义的验证规则. 兼容 IE 6+, Chrome, ...
- 架构验证过程发现非数据类型错误 validation found non-data type errors
问题: infopath报一下错误 validation found non-data type errors 架构验证过程发现非数据类型错误 原因: 重复表字段在后台代码里要一一对应,否则报错. 错 ...
- ORA-19563: header validation failed for file
在测试服务器还原数据库时遇到了ORA-19563错误.如下所示 RMAN-00571: ======================================================== ...
- [WPF系列]-Data Validation
项目经常前台界面涉及到用户输入时,我们常常会用到数据有效性的验证.在网页中我们之前用js来校验Form中的数据有效性.在WPF中我们如何实现这种验证机制了?答案:INotifyDataErrorInf ...
- Struts2 Validation学习
Every input is evil! ------------------------------华丽的分割线----------------------------------- 客户端提交的数 ...
随机推荐
- WCF配置文件详解(一)
<?xml version="1.0" encoding="utf-8" ?><configuration> <!-- &l ...
- TPL
namespace TPLTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } pr ...
- C: Answers to “The C programming language, Edition 2”
<The C programming language> Edition 2的习题答案地址: http://users.powernet.co.uk/eton/kandr2/index.h ...
- httpServer V1
package cn.edu.sss.httpServer; import java.io.BufferedReader; import java.io.IOException; import jav ...
- 《Data-Intensive Text Processing with mapReduce》读书笔记之一:前言
暑假闲得蛋痒,混混沌沌,开始看<Data-Intensive Text Processing with mapReduce>,尽管有诸多单词不懂,还好六级考多了,虽然至今未过:再加上自己当 ...
- xcode archive导出ipa时重签名
折腾了一晚上用另外的签名从xcode archive导出ipa,最后发现居然是没有导入p12文件的原因.... 顺便把参考的帖子记录一下: http://stackoverflow.com/quest ...
- HW5.35
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- leetcode@ [34] Search for a Range (STL Binary Search)
https://leetcode.com/problems/search-for-a-range/ Given a sorted array of integers, find the startin ...
- 查看Linux系统之终端登录的方式(last命令)
更多,请看他人博客:last 命令 http://www.cnblogs.com/kerrycode/p/4223751.html http://www.xitongzhijia.net/xtjc/2 ...
- Hadoop概念学习系列之hadoop、spark常备查询网址(二十九)
http://archive.apache.org/dist