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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] ### **1、簡介** [Laravel](http://laravelacademy.org/tags/laravel "View all posts in Laravel")?的?`[Hash](http://laravelacademy.org/tags/hash "View all posts in Hash")`?[門面](http://laravelacademy.org/post/2920.html)為存儲用戶[密碼](http://laravelacademy.org/tags/%e5%af%86%e7%a0%81 "View all posts in 密碼")提供了安全的?[Bcrypt](http://laravelacademy.org/tags/bcrypt "View all posts in Bcrypt")?哈希算法。如果你正在使用 Laravel 應用自帶的`AuthController`?控制器,將會自動為注冊和認證使用該 Bcrypt。 Bcrypt 是散列密碼的絕佳選擇,因為其“工作因子”是可調整的,這意味著隨著硬件功能的提升,生成哈希所花費的時間也會增加。 ### **2、基本使用** 可以調用?`Hash`?門面上的?`make`?方法散列存儲密碼: ~~~ <?php namespace App\Http\Controllers; use Hash; use App\User; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class UserController extends Controller{ /** * 更新用戶密碼 * * @param Request $request * @param int $id * @return Response */ public function updatePassword(Request $request, $id) { $user = User::findOrFail($id); // 驗證新密碼長度... $user->fill([ 'password' => Hash::make($request->newPassword) ])->save(); } } ~~~ 此外,還可以使用全局的輔助函數?`bcrypt`: ~~~ bcrypt('plain-text'); ~~~ ##### **驗證哈希密碼** `check`?方法允許你驗證給定原生字符串和給定哈希是否相等,然而,如果你在使用 Laravel 自帶的?`AuthController`(詳見[用戶認證](http://laravelacademy.org/post/3074.html)一節),就不需要再直接使用該方法,因為自帶的認證控制器自動調用了該方法: ~~~ 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>

                              哎呀哎呀视频在线观看