1
我试图按照CI的3个文档有关加密https://codeigniter.com/userguide3/libraries/encryption.html#setting-your-encryption-key
我应用指令的指令,但它不会让漂亮输出像我想,这里是标准的代码动态加密密钥
$this->load->library('encryption');
$key = $this->encryption->create_key(16);
// Get a hex-encoded representation of the key:
$key = bin2hex($this->encryption->create_key(16));
// Put the same value in your config with hex2bin(),
// so that it is still passed as binary to the library:
$config['encryption_key'] = hex2bin(<your hex-encoded key>);
,但我得到这个错误
如何解决这个问题?或者我正在写一些错误的代码?
$ this'''是你的控制器类的一个实例。你不能在配置中使用它。你有类似'''$ CI =&get_instance();'''的实例并调用'''$ CI-> load-> library('encryption'); $关键= $ CI->加密 - > create_key(16);''' – kishor10d
我觉得你是写在'''config.php'''的代码,而不是编写代码的控制器。 – kishor10d
为了您的笨ENC关键https://randomkeygen.com/ – user4419336