FormValidation
extends CI_Form_validation
in package
CI_Form_validation extension.
Table of Contents
Methods
- __construct() : mixed
- Initialize FormValidation.
- datetime() : bool
- Check if it is the date and time.
- email() : bool
- Check if it is an e-mail.
- hostname() : bool
- Check if it is a host name.
- hostname_or_ipaddress() : bool
- Check if it is a host name or IP.
- ipaddress() : bool
- Check if it is an IP.
- ipaddress_or_cidr() : bool
- Check if it is IP or CIDR format.
- is_path() : bool
- Check if it is a file (directory) path.
- port() : bool
- Check if it is a port number.
- unix_username() : bool
- Check if it is a unix user name.
Methods
__construct()
Initialize FormValidation.
public
__construct([array<string|int, mixed> $rules = [] ]) : mixed
Parameters
- $rules : array<string|int, mixed> = []
-
(optional) Validation Rules.
datetime()
Check if it is the date and time.
public
datetime(string $value, string $format) : bool
$this->form_validation
->set_data(['datetime' => '2021-02-03 17:46:00'])
->set_rules('datetime', 'datetime', 'required|datetime[Y-m-d H:i:s]');
Parameters
- $value : string
-
Input value.
- $format : string
-
Date Format.
Return values
bool —Check Results.
email()
Check if it is an e-mail.
public
email(string $value) : bool
The verification method uses the regular expression proposed in the HTML5 specification. https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.
hostname()
Check if it is a host name.
public
hostname(string $value) : bool
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.
hostname_or_ipaddress()
Check if it is a host name or IP.
public
hostname_or_ipaddress(string $value) : bool
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.
ipaddress()
Check if it is an IP.
public
ipaddress(string $value) : bool
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.
ipaddress_or_cidr()
Check if it is IP or CIDR format.
public
ipaddress_or_cidr(string $value) : bool
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.
is_path()
Check if it is a file (directory) path.
public
is_path(string $value[, mixed $denyLeadingSlash = false ]) : bool
Parameters
- $value : string
-
Input value.
- $denyLeadingSlash : mixed = false
-
Whether leading slashes are allowed or not.
Return values
bool —Check Results.
port()
Check if it is a port number.
public
port(string $value) : bool
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.
unix_username()
Check if it is a unix user name.
public
unix_username(string $value) : bool
Parameters
- $value : string
-
Input value.
Return values
bool —Check Results.