Good morning,
I am creating a configuration file in php to manage the variables of my website.
I would like, thanks to a php script, to be able to modify a specific line of my configuration file.
I tried this code:
$file_content = file('manager/libs/config.php');
$file_content[11] = "ligne changée";
$fh = fopen('manager/libs/config.php', 'r+');
foreach($file_content as $line)
{
fputs($fh, $line."\r");
}
fclose($fh);
Unfortunately, he writes well to the line concerned (line 12), but he moves all the other lines. It’s hard to explain because I don’t understand exactly what he’s doing...
Here is my request: Have a php script allowing me to modify a very precise line of my configuration file without interfering with the others.
I have done a lot of research on this but no script is suitable for my use...