PHP 클래스 yii\validators\StringValidator

Note, this validator should only be used with string-typed attributes.
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends Validator
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$encoding the encoding of the string value to be validated (e.g. 'UTF-8'). If this property is not set, [[\yii\base\Application::charset]] will be used.
$length specifies the length limit of the value to be validated. This can be specified in one of the following forms: - an integer: the exact length that the value should be of; - an array of one element: the minimum length that the value should be of. For example, [8]. This will overwrite [[min]]. - an array of two elements: the minimum and maximum lengths that the value should be of. For example, [8, 128]. This will overwrite both [[min]] and [[max]].
$max maximum length. If not set, it means no maximum length limit.
$message user-defined error message used when the value is not a string.
$min minimum length. If not set, it means no minimum length limit.
$notEqual user-defined error message used when the length of the value is not equal to [[length]].
$tooLong user-defined error message used when the length of the value is greater than [[max]].
$tooShort user-defined error message used when the length of the value is smaller than [[min]].

공개 메소드들

메소드 설명
clientValidateAttribute ( $model, $attribute, $view )
init ( )
validateAttribute ( $model, $attribute )

보호된 메소드들

메소드 설명
validateValue ( $value )

메소드 상세

clientValidateAttribute() 공개 메소드

public clientValidateAttribute ( $model, $attribute, $view )

init() 공개 메소드

public init ( )

validateAttribute() 공개 메소드

public validateAttribute ( $model, $attribute )

validateValue() 보호된 메소드

protected validateValue ( $value )

프로퍼티 상세

$encoding 공개적으로 프로퍼티

the encoding of the string value to be validated (e.g. 'UTF-8'). If this property is not set, [[\yii\base\Application::charset]] will be used.
public $encoding

$length 공개적으로 프로퍼티

specifies the length limit of the value to be validated. This can be specified in one of the following forms: - an integer: the exact length that the value should be of; - an array of one element: the minimum length that the value should be of. For example, [8]. This will overwrite [[min]]. - an array of two elements: the minimum and maximum lengths that the value should be of. For example, [8, 128]. This will overwrite both [[min]] and [[max]].
또한 보기: tooShort for the customized message for a too short string.
또한 보기: tooLong for the customized message for a too long string.
또한 보기: notEqual for the customized message for a string that does not match desired length.
public $length

$max 공개적으로 프로퍼티

maximum length. If not set, it means no maximum length limit.
또한 보기: tooLong for the customized message for a too long string.
public $max

$message 공개적으로 프로퍼티

user-defined error message used when the value is not a string.
public $message

$min 공개적으로 프로퍼티

minimum length. If not set, it means no minimum length limit.
또한 보기: tooShort for the customized message for a too short string.
public $min

$notEqual 공개적으로 프로퍼티

user-defined error message used when the length of the value is not equal to [[length]].
public $notEqual

$tooLong 공개적으로 프로퍼티

user-defined error message used when the length of the value is greater than [[max]].
public $tooLong

$tooShort 공개적으로 프로퍼티

user-defined error message used when the length of the value is smaller than [[min]].
public $tooShort