Security.salt value in controller

2019-06-01 05:43发布

In cakephp there is one file core.php It contains

Configure::write('Security.salt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

How can i get the value of Security.salt in controller in cakephp.

Thanks

4条回答
孤傲高冷的网名
2楼-- · 2019-06-01 06:24

The above answers have not proven to be successful in CakePHP3.

Configure::Read('Security.salt') will return a blank value.

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()

查看更多
爷、活的狠高调
3楼-- · 2019-06-01 06:24

You can get Security.salt value from below given url

http://www.sethcardoza.com/tools/random-password-generator/

Use 40 char long Salt

Configure::write('Security.salt','#IDjVn^BeZQ_kK)V5oFzk#s&8LSq44zVqN36SP^T');

查看更多
倾城 Initia
4楼-- · 2019-06-01 06:26

Just try like this

Configure::read('Security.salt');

it will give you the value. For more info check here

查看更多
\"骚年 ilove
5楼-- · 2019-06-01 06:30
Configure::read("Security.salt");
查看更多
登录 后发表回答