2017 © Pedro Peláez
 

library codeigniter_encryption

image

jsnlib/codeigniter_encryption

  • Friday, March 30, 2018
  • by fdjkgh580
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Encryption

範例

class Welcome extends CI_Controller {

    public function index()
    {
        // 1. 使用 encryption 類別
        $this->load->library('encryption');

        // 2. 初始化並在建構子置入 CI 原生的 encryption 物件
        $this->jsnlib_ecp = new \Jsnlib\Codeigniter\Encryption($this->encryption);

        // 3. 產生加密字串
        $token = $this->jsnlib_ecp->encrypt(
        [
            'name' => 'Jason',
            'age' => 18,
            'expiry' => '2019-01-01 10:00:00' //若不指定過期時間,將自動添加預設值
        ]);

        // 4. 解密字串
        $ary = $this->jsnlib_ecp->decrypt($token);
    }

}

說明

encrypt(array $param): string

@param expiry 若不指定過期時間,將自動添加預設值  , (*1)

@return 將加密過的資料以 base64 的格式輸出, (*2)

decrypt(string $encrypt): array

@param encrypt 加密的文字  , (*3)

@return is_expired 是否已經過期, (*4)

@return data 加密前的原始資料, (*5)

The Versions

30/03 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

30/03 2018

1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

22/03 2018

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

07/03 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires