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)); |
In View File
|
1 2 3 |
<?php $encrypter = \Config\Services::encrypter(); ?> |
|
1 |
<a href="<?= base_url('customer/order-detail/' . bin2hex($encrypter->encrypt($order['orderid']))) ?>">View Order</a> |
