當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validator::not方法代碼示例

本文整理匯總了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) {
開發者ID:URFacilities,項目名稱:form_additional_pay,代碼行數:31,代碼來源:process_request.php

示例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));
 }
開發者ID:narrowspark,項目名稱:framework,代碼行數:18,代碼來源:Validator.php

示例3: testShouldReturnANewValidatorInstanceWhenTheNotRuleIsCalledWithoutAnyArgument

 /**
  * Regression test #174.
  */
 public function testShouldReturnANewValidatorInstanceWhenTheNotRuleIsCalledWithoutAnyArgument()
 {
     $validator = new Validator();
     $this->assertInstanceOf('Respect\\Validation\\Validator', $validator->not());
 }
開發者ID:00F100,項目名稱:Validation,代碼行數:8,代碼來源:ValidatorTest.php


注:本文中的Respect\Validation\Validator::not方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。