Home PHP Libraries Other libraries valitron-masterPHP data validation library
valitron-masterPHP data validation library
<?php
namespace Valitron;
/**
 * Validation Class
 *
 * Validates input against certain criteria
 *
 * @package Valitron
 * @author  Vance Lucas <vance@vancelucas.com>
 * @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 is an informational term, part of the compilation process in which the code is checked for compliance with a specific set of defined rules to allow verification of certain security requirements.

The common language runtime can verify Microsoft Intermediate Language (MSIL).

Server-side verification means that after the form is submitted, the server-side uses JAVA and waits for the server-side code to verify the customer's input.


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

[Data Validation Class Library] Share 10 useful PHP data validation classes [Data Validation Class Library] Share 10 useful PHP data validation classes

06 Jun 2017

When friends learn the PHP language, they will definitely pay attention to security issues in the actual development process. So, today we will introduce to you the primary measure to ensure PHP security-verification data. Validation of data is the most important habit you can adopt. And when it comes to input, it's very simple: don't trust the user.

Data validation library in PHP8.0: Respect Data validation library in PHP8.0: Respect

14 May 2023

With the popularity of the PHP language and the expansion of its application scope, data verification has become more and more important. Data validation is an important link in a web application, responsible for verifying and filtering user-submitted data and ensuring its integrity and validity. Without a strong data validation system to ensure data security and reliability, a simple input error can lead to catastrophic consequences. In PHP8.0, Respect is a good solution. What is Respect? Respect is a lightweight

Universal validation library for front-end data based on jQuery_jquery Universal validation library for front-end data based on jQuery_jquery

16 May 2016

After doing development for such a long time, I have been very troubled by verification issues. I keep writing a lot of repetitive code, which is quite painful for me who wants to be lazy.

How to import third-party libraries in ThinkPHP How to import third-party libraries in ThinkPHP

03 Jun 2023

Third-party class libraries Third-party class libraries refer to other class libraries besides the ThinkPHP framework and application project class libraries. They are generally provided by third-party systems or products, such as class libraries of Smarty, Zend and other systems. For the class libraries imported earlier using automatic loading or the import method, the ThinkPHP convention is to use .class.php as the suffix. Non-such suffixes need to be controlled through the import parameters. But for the third type of library, since there is no such agreement, its suffix can only be considered to be php. In order to easily introduce class libraries from other frameworks and systems, ThinkPHP specifically provides the function of importing third-party class libraries. Third-party class libraries are uniformly placed in the ThinkPHP system directory/

Use jquery.noConflict() to solve the problem of conflicts between jquery library and other libraries Use jquery.noConflict() to solve the problem of conflicts between jquery library and other libraries

20 Jun 2017

When developing with jQuery, you may also use other JS libraries, such as Prototype, but conflicts may occur when multiple libraries coexist; if conflicts occur, you can solve them through the following solutions: 1. jQuery libraries in other Import the library before and use the jQuery (callback) method directly such as:

What are linux dependency packages What are linux dependency packages

24 Mar 2023

Linux dependency packages refer to "library files". Most dependency packages are library files, including dynamic libraries and static libraries. Linux systems, like other operating systems, are modular in design, which means that functions depend on each other, and some Functions require some other functions to support them, which can improve code reusability.

See all articles