<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] ### **1、配置** 在使用[Laravel](http://laravelacademy.org/tags/laravel "View all posts in Laravel")的[加密](http://laravelacademy.org/tags/%e5%8a%a0%e5%af%86 "View all posts in 加密")器之前,應該在配置文件`config/app.php`中設置`key`選項為32位隨機字符串。如果這個值沒有被設置,所有Laravel加密過的值都是不[安全](http://laravelacademy.org/tags/%e5%ae%89%e5%85%a8 "View all posts in 安全")的。 ### **2、基本使用** #### **2.1 加密** 你可以使用`[Crypt](http://laravelacademy.org/tags/crypt "View all posts in Crypt")`門面對數據進行加密,所有加密值都使用[OpenSSL](http://laravelacademy.org/tags/openssl "View all posts in OpenSSL")和`AES-256-CBC`密碼進行加密。此外,所有加密值都通過一個消息認證碼(MAC)來檢測對加密字符串的任何修改。 例如,我們可以使用`encrypt`方法加密`secret`屬性并將其存儲到[Eloquent模型](http://laravelacademy.org/post/2995.html): ~~~ <?php namespace App\Http\Controllers; use Crypt; use App\User; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class UserController extends Controller{ /** * Store a secret message for the user. * * @param Request $request * @param int $id * @return Response */ public function storeSecret(Request $request, $id) { $user = User::findOrFail($id); $user->fill([ 'secret' => Crypt::encrypt($request->secret) ])->save(); } } ~~~ #### **2.2?[解密](http://laravelacademy.org/tags/%e8%a7%a3%e5%af%86 "View all posts in 解密")** 當然,你可以使用`Crypt`門面上的`decrypt`方法進行解密。如果該值不能被解密,例如MAC無效,將會拋出一個`Illuminate\Contracts\Encryption\DecryptException`異常: ~~~ use Illuminate\Contracts\Encryption\DecryptException; try { $decrypted = Crypt::decrypt($encryptedValue); } catch (DecryptException $e) { // } ~~~
                  <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>

                              哎呀哎呀视频在线观看