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


PHP Str::equals方法代碼示例

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


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

示例1: same

 public static function same(Entity $page, array $data, $strict = true)
 {
     if (Str::equals($page->link, $data['link'])) {
         return true;
     }
     return $strict ? false : Str::equals($page->title, $data['title']) || $page->annotation && Str::equals($page->annotation, @$data['annotation']);
 }
開發者ID:ankhzet,項目名稱:Ankh,代碼行數:7,代碼來源:PageSynker.php

示例2: tokensMatch

 /**
  * Determine if the session and input CSRF tokens match.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 protected function tokensMatch($request)
 {
     $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
     if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
         $token = $this->encrypter->decrypt($header);
     }
     return Str::equals($request->session()->token(), $token);
 }
開發者ID:alvarobfdev,項目名稱:LaravelCore,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例3: tokensMatch

 /**
  * 由於係統默認的get請求不支持驗證csrf,所以這裏手動的來驗證
  */
 public function tokensMatch()
 {
     $token = Session::token();
     $header = Request::header('X-XSRF-TOKEN');
     $match = Str::equals($token, Request::input('_token')) || $header && Str::equals($token, $header);
     if (!$match) {
         throw new TokenMismatchException();
     }
 }
開發者ID:mikegit2014,項目名稱:laravelback,代碼行數:12,代碼來源:CsrfValidate.php

示例4: tokensMatch

 protected function tokensMatch($request)
 {
     // Don't validate CSRF when testing.
     if (env('APP_ENV') === 'testing') {
         return true;
     }
     Log::info('Request: ' . implode(',', $request->all()));
     $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
     Log::info('Sent token 1: ' . $token);
     if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
         $token = $this->encrypter->decrypt($header);
     }
     Log::info('Sent token 2: ' . $token);
     Log::info('Stored token: ' . $request->session()->token());
     return Str::equals($request->session()->token(), $token);
     //return parent::tokensMatch($request);
 }
開發者ID:abada,項目名稱:backend,代碼行數:17,代碼來源:VerifyCsrfToken.php

示例5: preRequestHandle

 /**
  * @param SessionInterface $session
  * @param Request $request
  */
 private function preRequestHandle(SessionInterface $session, Request $request)
 {
     $id = $request->cookie($this->key);
     $key = 'session:' . $id;
     if (!Str::equals($key, $session->getId())) {
         $this->redis->del($key);
         return;
     }
     $value = $this->redis->get('session:' . $key);
     $content = Json::parse($value);
     if ($content['last_seen'] > $session->get('last_seen')) {
         foreach ($content as $key => $value) {
             if (!Str::startsWith($key, ['_', 'login_'])) {
                 $session->set($key, $value);
             }
         }
     }
 }
開發者ID:spyc,項目名稱:elearn-foundation,代碼行數:22,代碼來源:CommonSession.php

示例6: handle

 /**
  * Handles the request made to StyleCI by the GitHub API.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function handle()
 {
     $class = 'StyleCI\\StyleCI\\Events\\Repo\\GitHub\\GitHub' . ucfirst(camel_case(Request::header('X-GitHub-Event'))) . 'Event';
     if (!class_exists($class)) {
         throw new BadRequestHttpException('Event not supported.');
     }
     $data = Request::input();
     $repo = Repo::find($data['repository']['id']);
     if (!$repo) {
         throw new BadRequestHttpException('Request integrity validation failed.');
     }
     list($algo, $sig) = explode('=', Request::header('X-Hub-Signature'));
     $hash = hash_hmac($algo, Request::getContent(), $repo->token);
     if (!Str::equals($hash, $sig)) {
         throw new BadRequestHttpException('Request integrity validation failed.');
     }
     event(new $class($repo, $data));
     return new JsonResponse(['message' => 'Event successfully received.']);
 }
開發者ID:mikaelmattsson,項目名稱:StyleCI,代碼行數:24,代碼來源:GitHubController.php

示例7: getUserByResetCode

 public function getUserByResetCode(array $data)
 {
     $user = $this->userRepo->getUserByEmail($data['email']);
     if (!$user) {
         return null;
     }
     $passwordResetToken = $user->passwordResetToken;
     if (!$passwordResetToken) {
         return null;
     }
     if (!$passwordResetToken->isActive()) {
         $passwordResetToken->delete();
         return null;
     }
     if (!Str::equals($passwordResetToken->getDecryptedCode(), $data['code'])) {
         return null;
     }
     if ($user->email !== $passwordResetToken->email) {
         $passwordResetToken->delete();
         return null;
     }
     return $user;
 }
開發者ID:practicegeniusci,項目名稱:DemoApp,代碼行數:23,代碼來源:PasswordBroker.php

示例8: str_equal

 /**
  * Compares two strings using a constant-time algorithm.
  *
  * Note: This method will leak length information.
  *
  * Note: Adapted from Symfony\Component\Security\Core\Util\StringUtils.
  *
  * @param  string  $knownString
  * @param  string  $userInput
  *
  * @return bool
  */
 function str_equal($knownString, $userInput)
 {
     return \Illuminate\Support\Str::equals($knownString, $userInput);
 }
開發者ID:vuongabc92,項目名稱:researchdrupal7cmsasbeginer,代碼行數:16,代碼來源:helpers.php

示例9: validMac

 /**
  * Determine if the MAC for the given payload is valid.
  *
  * @param  array  $payload
  * @return bool
  *
  * @throws \RuntimeException
  */
 protected function validMac(array $payload)
 {
     $bytes = random_bytes(16);
     $calcMac = hash_hmac('sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true);
     return Str::equals(hash_hmac('sha256', $payload['mac'], $bytes, true), $calcMac);
 }
開發者ID:nhowell,項目名稱:framework,代碼行數:14,代碼來源:BaseEncrypter.php

示例10: equals

 /**
  * Determine if the string equals the given input.
  *
  * @param  string  $input
  * @return bool
  */
 public function equals($input)
 {
     return Str::equals($this->string, $input);
 }
開發者ID:laraplus,項目名稱:string,代碼行數:10,代碼來源:StringBuffer.php


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