validate::get()
Retrieve and validate an HTTP GET query parameter values.
Prototype
string get(string $key, array $validations, string $invalid_message = NULL)
Parameters
- key - Name of the parameter to retrieve.
- validations - An array of validate strings or object/method pairs.
- invalid_message - Message to log in validation error if the value does not pass all validations.
Return
Returns the value, even if it does not validate. Check validate::valid() to determine if the value is valid.
Example
$validate = new \io_comand_web\validate();
$validate->get('email',
['trim', 'required', 'email'],
'Invalid email address'
);
if($validate->valid()) {
echo('Email is valid.');
}