0

Hi i need the codeigniter encryption library encryption key to set form external file because i dont want this to set in config.php file because of security.

 $config['encryption_key'] = 'my_key';

2 Answers 2

1

You can use Loading custom config file :-

After create custom config file we need to load it get it’s items. for load custom config we have two ways.

  1. Manual loading :- we can manual load config file in controller/model like

     $this->config->load('file_name'); //or use custom_config instead of file_name
    

where “file_name” is your custom config file name without .php extension.

  1. Autoloading :- for auto load config file go to “application/config/autoload.php” and add code in $autoload[‘config’]

    $autoload['config'] = array('config_custom'); //where config_custom is your file name.
    
Sign up to request clarification or add additional context in comments.

Comments

0

Make a new config file application/config/config1.php.with

$config['encryption_key'] = 'my_key';

Now load it form application/config/autoload.php as below:

$autoload['config'] = array('config1');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.