久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      yii加密字符串亂碼

      Yii提供了方便的幫助函數(shù)來讓你用一個安全秘鑰來加密解密數(shù)據(jù)。數(shù)據(jù)通過加密函數(shù)進行傳輸,這樣只有擁有安全秘鑰的人才能解密。

      yii加密字符串亂碼

      yii加密字符串亂碼

      首先,加密數(shù)據(jù)

      $encryptedData = Yii::$app->getSecurity()->encryptByPassword($data, $secretKey);

      $data 是你要加密的內(nèi)容,

      $secretKey 是你自己設(shè)置的密碼,

      隨后,當用戶需要讀取數(shù)據(jù)時:

      相關(guān)文章教程推薦:yii教程

      $data = Yii::$app->getSecurity()->decryptByPassword($encryptedData, $secretKey);

      $encryptedData 是你要解密的內(nèi)容

      $secretKey 是你自己設(shè)置加密時的密碼

      但是對字符串進行加密,加密后的字符串看起來是一串亂碼。

      解決方法:

      我們可以使用base64處理加密后的字符串, 處理后的字符串是由字母和數(shù)字組成

      應(yīng)用實例:

      //邀請注冊 $id = Yii::$app->user->getId();//獲取登錄用戶id
      //加密(此處加密密碼設(shè)為空) $uid = base64_encode(yii::$app->security->encryptByPassword($id,''));
      //解密 $iss=yii::$app->security->decryptByPassword(base64_decode($uid),'');

      請訪問 編程教程 ,獲取

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號