1


I am using this PHP Class to write ini files.

I use below code to update ini file;

<?php
include("class.iniparser.php");
$cfg = new iniParser("config.ini");
$cfg->setValue("Tool","version", "0.9beta");
$cfg->save();
?>


config.ini as below;

[Tool]
name = mein kleiner Parser
version = 0.9alpha
lastmodified = 2006-01-16

When I have a comment line (ex: #company = example.com), it will automatically delete it.

I want to update config.ini file without deleting comment lines
Is there a way to achieve it?

I have tried stackoverflow, Config_Lite, Piwik/Ini and PHP INI Read and Write Class
All are giving the same result

Appreciate your support

Community
  • 1
  • 1
Supun Silva
  • 580
  • 5
  • 21

1 Answers1

0

A bit late to the party - I had the same issue and added code to one of the Piwik/component-ini that adds this functionality.

You can see the changed file here. Just add the lines to your IniWriter.php and you're all set.

mark
  • 344
  • 3
  • 8