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


PHP Validator::xdigit方法代碼示例

本文整理匯總了PHP中Respect\Validation\Validator::xdigit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validator::xdigit方法的具體用法?PHP Validator::xdigit怎麽用?PHP Validator::xdigit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Respect\Validation\Validator的用法示例。


在下文中一共展示了Validator::xdigit方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validatePasswordResetRequest

 public function validatePasswordResetRequest($email, $token)
 {
     Auth::restrictAccess('anonymous');
     $passwordResets = new PasswordResets();
     // This needs to go into base functions and return some kind of json message
     if (!v::email()->validate($email)) {
         return 'email dont comply';
     }
     if (!v::xdigit()->length(32, 32)->validate($token)) {
         return 'token dont comply';
     }
     $passwordReset = $passwordResets->show($email);
     // Not going to reveal whether the user account was found...
     if (empty($passwordReset['token']) || empty($passwordReset['created'])) {
         echo 'password reset request not found. forward. please submit a password reset request first';
         die;
     }
     $created = strtotime($passwordReset['created']);
     $now = strtotime(date('Y-m-d H:i:s'));
     $diff = round(($now - $created) / 60, 2);
     if (intval($diff) > 60) {
         echo 'password reset has expired. 60 minutes max. submit another reset request';
         die;
     }
     if (password_verify($token, $passwordReset['token'])) {
         // probably shouldnt disclose this. just send json success
         echo 'password matches. proceed to reset.';
     }
     return $passwordReset;
 }
開發者ID:aodkrisda,項目名稱:slim3-api,代碼行數:30,代碼來源:PasswordResetController.php

示例2: validXdigit

 /**
  * Verifica se o valor possui apenas caracteres hexadecimal
  * @param string $value
  * @return boolean
  */
 public function validXdigit($value)
 {
     if (!v::xdigit()->validate($value)) {
         Factory::log()->warn('Valor deve possuir apenas caracteres hexadecimal');
         return false;
     }
     return true;
 }
開發者ID:diego3,項目名稱:myframework-core,代碼行數:13,代碼來源:DatatypeStringBase.php


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