<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                * * * * * [TOC] ## 簡介 Laravel?`Hash`?[Facade](Facades.md)?提供安全的 Bcrypt 哈希保存用戶密碼。 如果應用程序中使用了 Laravel 內置的?`LoginController`?和?`RegisterController`?類,它們將自動使用 Bcrypt 進行注冊和身份驗證。 > {tip} Bcrypt 是哈希密碼的理想選擇,因為它的「加密系數」可以任意調整,這意味著生成哈希所需的時間可以隨著硬件功率的增加而增加。 ## 基本用法 你可以通過調用?`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(); } } ~~~ `make`?方法還能使用?`rounds`?選項來管理 bcrypt 哈希算法的加密系數。然而,大多數應用程序還是能接受默認值的: ~~~ $hashed = Hash::make('password', [ 'rounds' => 12 ]); ~~~ #### 根據哈希值驗證密碼 `check`?方法可以驗證給定的純文本字符串對應于給定的散列。 如果使用?[Laravel 內置的](用戶認證.md)?`LoginController`,則不需要直接使用該方法,因為該控制器會自動調用此方法: ~~~ if (Hash::check('plain-text', $hashedPassword)) { // 密碼對比... } ~~~ #### 檢查密碼是否需要重新加密 `needsRehash`?函數允許你檢查已加密的密碼所使用的加密系數是否被修改: ~~~ if (Hash::needsRehash($hashed)) { $hashed = Hash::make('plain-text'); } ~~~
                  <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>

                              哎呀哎呀视频在线观看