• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write to config file


I'm making installation file, how can I write to e.g. database config file with fwrite()?
I want to change value of hostname, username, password, database name. How can I select these particular array elements?

You can create CodeIgniter config.tpl files with dummy values and use
str_replace to replace the dummy values with the inputted values.

1) open and read the ./application/config.tpl config file
2) use str_replace to add the correct values
3) save and write the config.php file to the ./application/config folder

This can be used to write any type of CodeIgniter configuration file.

I'll see if I can give you an example later today.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Thanks, I know now how to make it! Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.