📄 nonemptyrule.class.php
字号:
<?php lt_include(PLOG_CLASS_PATH."class/data/validator/rules/rule.class.php"); define( "ERROR_RULE_VALUE_IS_EMPTY", "error_rule_value_is_empty"); /** * \ingroup Validator_Rules * * Validates if a string is empty or not */ class NonEmptyRule extends Rule { /** * Initializes the rule */ function NonEmptyRule() { $this->Rule(); } /** * Returns true if the value is not empty or false otherwise. If empty, * the error ERROR_RULE_VALUE_IS_EMPTY will be set. * * @param value the string that we'd like to validate * @return true if successful or false otherwise */ function validate($value) { if( $value == null || $value == "" || trim($value) == "" ) { $this->_setError( ERROR_RULE_VALUE_IS_EMPTY ); return false; } else { return true; } } }?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -