I read documents and I am not able to get it how to get Security.salt
value from app.php
in Cakephp 3
. I am trying to get it like this
$salt = Configure::read('Security.salt');
Importing following libraries
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
Kindly help.
Cakephp version is 3.4
Configure::Read('Security.salt')
will return a blank value in cakephp 3.x before cakephp 3 version it worked.
In-order to read the salt from the configuration file you'll need to include the Security namespace:
use Cake\Utility\Security;
And you can retrieve the value of the salt using:
Security::salt()
Example-
echo Security::salt();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With