Class Validation

Description

数据验证类

Located in /ORG/Text/Validation.class.php (line 24)

Base
   |
   --Validation
Variable Summary
static integer $regex
Method Summary
static boolean check (string $value, string $checkName)
static string getRegex (string $name)
Variables
static integer $regex = array(
'require'=> '/.+/', //匹配任意字符,除了空和断行符
'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',
'phone' => '/^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/',
'mobile' => '/^((\(\d{2,3}\))|(\d{3}\-))?13\d{9}$/',
'url' => '/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/',
'currency' => '/^\d+(\.\d+)?$/',
'number' => '/\d+$/',
'zip' => '/^[1-9]\d{5}$/',
'qq' => '/^[1-9]\d{4,12}$/',
'integer' => '/^[-\+]?\d+$/',
'double' => '/^[-\+]?\d+(\.\d+)?$/',
'english' => '/^[A-Za-z]+$/',
)
(line 35)

预定义验证格式

  • access: protected
Methods
static check (line 64)

验证数据项

  • throws: ThinkExecption
  • access: public
static boolean check (string $value, string $checkName)
  • string $checkName: 验证的数据类型名或正则式
  • string $value: 要验证的数据
static getRegex (line 83)

取得验证类型的正则表达式

  • throws: ThinkExecption
  • access: public
static string getRegex (string $name)
  • string $name: 验证类型名称

Documentation generated on Thu, 27 Mar 2008 08:21:00 +0000 by 塞北的雪