本文整理匯總了PHP中Respect\Validation\Validator::not方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validator::not方法的具體用法?PHP Validator::not怎麽用?PHP Validator::not使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Respect\Validation\Validator
的用法示例。
在下文中一共展示了Validator::not方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DBConnection
if (v::not(v::alnum("-.,()'"))->validate($form_data['emp_lname'])) {
$err_msg .= "The last name of the employee must be alphanumeric.\\n";
}
//if(v::not(v::alnum("-.,()'"))->validate($form_data['account_number'])) { $err_msg .= "The account number must be alphanumeric.\\n"; }
// Phone
if (v::not(v::phone())->validate($form_data['requester_phone'])) {
$err_msg .= "Your phone number is not valid: " . $form_data['requester_phone'] . "\\n";
}
if (v::not(v::phone())->validate($form_data['dept_phone'])) {
$err_msg .= "The department phone number is not valid: " . $form_data['dept_phone'] . "\\n";
}
// Date or Time - should not be in future
if (v::not(v::date('Y-m-d')->max('today'))->validate($mysql_start_date)) {
$err_msg .= "The start date is invalid: " . $start_date . "\\n";
}
if (v::not(v::date('Y-m-d')->max('today'))->validate($mysql_end_date)) {
$err_msg .= "The end date is invalid: " . $end_date . "\\n";
}
// ========================================================================================
// DATA PASSED VALIDATION - INSERT INTO DB AND SEND EMAILS
// ========================================================================================
if ($err_msg == '') {
// ========================================================================================
// GET BUSINESS MANAGER
// ========================================================================================
$facil_conn = new DBConnection('facil');
$conn1 = $facil_conn->openConnection();
$stmt1 = $conn1->prepare("SELECT hr_business_mgr.mgr_fname, hr_business_mgr.mgr_lname, hr_business_mgr.mgr_email FROM hr_business_mgr, a_workplaces WHERE a_workplaces.workplace = :dept AND a_workplaces.business_mgr = hr_business_mgr.mgrID");
$stmt1->bindParam(":dept", $department, PDO::PARAM_STR);
$stmt1->execute();
if ($stmt1->error) {
示例2: createNegativeOrOptionalValidator
/**
* Create a negative or optional validator instance.
*
* @param string $filter
* @param array $rules
*
* @return \Respect\Validation\Validator
*/
protected function createNegativeOrOptionalValidator(string $filter, array $rules) : RespectValidator
{
list($method, $parameters) = $this->parseStringRule($rules[0]);
unset($rules[0]);
$validator = call_user_func_array([RespectValidator::class, str_replace($filter, '', $method)], $parameters);
if ($filter === '!') {
return RespectValidator::not($this->createChainableValidators($validator, $rules));
}
return RespectValidator::optional($this->createChainableValidators($validator, $rules));
}
示例3: testShouldReturnANewValidatorInstanceWhenTheNotRuleIsCalledWithoutAnyArgument
/**
* Regression test #174.
*/
public function testShouldReturnANewValidatorInstanceWhenTheNotRuleIsCalledWithoutAnyArgument()
{
$validator = new Validator();
$this->assertInstanceOf('Respect\\Validation\\Validator', $validator->not());
}