⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 equalrule.class.php

📁 一个用PHP编写的
💻 PHP
字号:
<?php    lt_include(PLOG_CLASS_PATH."class/data/validator/rules/rule.class.php");    define( "DEFAULT_RULE_CASE_SENSITIVE", true);    define( "ERROR_RULE_VALUES_NOT_EQUAL", "error_rule_values_not_equal");    /**	 * \ingroup Validator_Rules	 *	 * checks whether an item is equal to another via the binary operator '=='.	 * Use the setEqualValue() method to set the first value and call the validate()	 * method with the second value.     */    class EqualRule extends Rule    {        var $_equalValue;        /**         * The constructor does nothing.         */        function EqualRule($equalValue)        {            $this->Rule();            $this->_equalValue = $equalValue;        }        /**         * @return returns the value we're comparing         */        function getEqualValue()        {            return $this->_equalValue;        }        /**         * Sets the value we're comparing to		 *		 * @param equalValue the valure we're comparing to         */        function setEqualValue($equalValue)        {            $this->_equalValue = $equalValue;        }        /**		 * Returns true if the two given values are equal. It will return ERROR_RULE_VALUES_NOT_EQUAL		 * if they're not         */        function validate($value)        {            if ($this->_equalValue == $value)            {                $this->_setError(false);                return true;            }            else            {                $this->_setError(ERROR_RULE_VALUES_NOT_EQUAL);                return false;            }        }    }?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -