当前位置: 首页>>代码示例>>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;未经允许,请勿转载。