Вопрос

I'm creating a setup script for a project, where a form would ask the user for database connection details (such as host, username and password), and it should store these in a file which the main system can use in the future.

How could this be accomplished - by generating an .ini file, or by using PHP to edit another PHP file?

Это было полезно?

Решение

Check This link

     $my_file = 'db.ini';
        $handle = fopen($my_file, 'w') or die('Cannot open file:  '.$my_file);
/*Writing*/
        $data = 'This is the data';
        fwrite($handle, $data);
/*Reading*/
$handle = fopen($my_file, 'r');
$data = fread($handle,filesize($my_file));
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top