【文件属性】:
文件名称:valitron-masterPHP数据验证库.zip
文件大小:37KB
文件格式:ZIP
更新时间:2022-07-31 04:51:36
类库下载-valitron-masterPHP数据验证库
<?php
namespace Valitron;
/**
* Validation Class
*
* Validates input against certain criteria
*
* @package Valitron
* @author Vance Lucas
* @link http://www.vancelucas.com/
*/
class Validator
{
public function __construct($data = array(), $fields = array(), $lang = null, $langDir = null)
{
// Allows filtering of used input fields against optional second array of field names allowed
// This is useful for limiting raw $_POST or $_GET data to only known fields
$this->_fields = !empty($fields) ? array_intersect_key($data, array_flip($fields)) : $data;
// set lang in the follow order: constructor param, static::$_lang, default to en
$lang = $lang ?: static::lang();
// set langDir in the follow order: constructor param, static::$_langDir, default to package lang dir
$langDir = $langDir ?: static::langDir();
// Load language file in directory
$langFile = rtrim($langDir, '/') . '/' . $lang . '.php';
if (stream_resolve_include_path($langFile) ) {
$langMessages = include $langFile;
static::$_ruleMessages = array_merge(static::$_ruleMessages, $langMessages);
} else {
throw new \InvalidArgumentException("Fail to load language file '" . $langFile . "'");
}
}验证(Verification)是信息术语,编译过程的一部分,在该过程中,对代码进行检查,看是否与定义的特定规则集相一致,以允许检验某些安全要求。公共语言运行库可以验证Microsoft中间语言(MSIL)。服务器端验证就是当表单提交后,在服务器端通过JAVA,等服务器端代码对客户输入进行验证。
【文件预览】:
valitron-masterPHP数据验证库
----php中文网下载站.url(114B)
----php中文网免费下载站.txt(219B)
----valitron-master()
--------README.md(11KB)
--------composer.json(717B)
--------src()
--------LICENSE.txt(2KB)
--------lang()