Encrypt & Decrypt in CI4, like id in parameter or anything.
STEP 1:
1 2 3 | public function __construct() { $this->encrypter = \Config\Services::encrypter(); } |
STEP 2: (Encrypt)
1 2 | $ids = '123' $id = bin2hex($this->encrypter->encrypt($ids)); |
STEP 3: (Decrypt)
1 | $id = $this->encrypter->decrypt(hex2bin($id)); |