<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # Laravel 的哈希加密 - [簡介](#introduction) - [基本用法](#basic-usage) <a name="introduction"></a> ## 簡介 Laravel 通過 `Hash` [facade](/docs/{{version}}/facades) 提供 Bcrypt 加密來保存用戶密碼。 如果您在當前的 Laravel 應用程序中使用了內置的 `LoginController` 和 `RegisterController` 類,它們將自動使用 Bcrypt 進行注冊和身份驗證。 > {tip} 由于 Bcrypt 的 「加密系數(word fator)」可以任意調整,這使它成為最好的加密選擇。這代表每一次加密的次數可以隨著硬件設備的升級而增加。 <a name="basic-usage"></a> ## 基本用法 你可以通過調用 `Hash` facade 的 `make` 方法加密一個密碼: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; use App\Http\Controllers\Controller; class UpdatePasswordController extends Controller { /** * 更新用戶密碼 * * @param Request $request * @return Response */ public function update(Request $request) { // Validate the new password length... $request->user()->fill([ 'password' => Hash::make($request->newPassword) ])->save(); } } #### 根據哈希值驗證密碼 check 方法允許你通過一個指定的純字符串跟哈希值進行驗證。 如果你目前正使用 [Laravel 內含的](/docs/{{version}}/authentication) `LoginController` , 你可能不需要直接使用該方法,它已經包含在控制器當中并且會被自動調用: if (Hash::check('plain-text', $hashedPassword)) { // 密碼對比... } #### 驗證密碼是否須重新加密 `needsRehash` 函數允許你檢查已加密的密碼所使用的加密系數是否被修改: if (Hash::needsRehash($hashed)) { $hashed = Hash::make('plain-text'); } ## 譯者署名 | 用戶名 | 頭像 | 職能 | 簽名 | | ---------------------------------------- | ---------------------------------------- | ---- | ---------------------------------------- | | [@GanymedeNil](https://github.com/GanymedeNil) | <img class="avatar-66 rm-style" src="https://dn-phphub.qbox.me/uploads/avatars/6859_1487055454.jpg?imageView2/1/w/100/h/100"> | 翻譯 | 爭做一個 Full Stack Developer [@GanymedeNil](http://weibo.com/jinhongyang) | --- > {note} 歡迎任何形式的轉載,但請務必注明出處,尊重他人勞動共創開源社區。 > > 轉載請注明:本文檔由 Laravel China 社區 [laravel-china.org](https://laravel-china.org) 組織翻譯,詳見 [翻譯召集帖](https://laravel-china.org/topics/5756/laravel-55-document-translation-call-come-and-join-the-translation)。 > > 文檔永久地址: https://d.laravel-china.org
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看