<?php
error_reporting(E_ALL);
echo '<br><font color="green">Test file before changes</font><br>';
echo nl2br(file_get_contents('test.ini'));
include_once('M_INI.class.php');
$CONF = new M_INI();
# Uncheck to use quotes
# $CONF -> use_quotes();
if (! $CONF->load('test.ini')) exit('File not found.');
$CONF->change('section1', 'value2', 'changed');
$CONF->remove('section1', 'value3');
$CONF->add('section2', 'value2', 'val2', 'Added by INI php class :');
$CONF->add('section3', 'value1', 'val1', 'Added by INI php class :');
if (! $CONF->save()) echo 'Cannot save file. Check permissions.<br>';
echo '<br><font color="green">Changed value of section1 value2 : '.$CONF->get('section1', 'value2').'</font><br>';
echo '<br><font color="green">Test file after changes</font><br>';
echo nl2br(file_get_contents('test.ini'));
?>
|