I'm using phalcon 5.2.2. trying to encrypt url but failed to get expected result cause url is encrypting but with error. unable to find what I'm doing wrong?
[Module.php]
use Phalcon\Encryption\Crypt;
$di->set('crypt',function() {
$crypt = new Crypt();
$crypt->setKey("T4\xb1\x8d\xa9\x98\x05\\\x8c\xbe\x1d\x07&[\x99\x18\xa4~Lc1\xbeW\xb3"); //
return $crypt;
},true);
[Controller]
public function productAction($enid = null)
{
$id = $this->crypt->decrypt($enid, $this->crypt->getKey());
$this->view->adata = Products::findFirstByid($id);
}
[View]
{% for data in adata %}
<a href="{{url.getBaseUri('')}}index/product/<?php echo($this->crypt->encrypt($data->id)); ?>">{{data.productName}}</a>
{% endfor %}
[OUTPUT]
