IniCommented
Parses standard INI files, maintaining comments within the file.
In contrast to
IniFile,
the IniCommented
container parses the ini file manually using
regular expressions and is slower.
If you only read the file, using IniFile is more appropriate since it's faster.
Option | Data Type | Default value | Описание |
---|---|---|---|
linebreak |
string | \n |
Character(s) used to separate lines from each other. |
Writing a .desktop file
<?php
require_once 'Config.php';
$conf = new Config();
$root = $conf->getRoot();
//note: inicommented uses ";" as comment indicator while the desktop entry spec
// says that it has to be "#" - so no comments for .desktop files
$entry = $root->createSection('Desktop Entry');
$entry->createDirective('Version', '1.0');
$entry->createDirective('Type', 'Link');
$entry->createDirective('URL', 'http://pear.php.net/');
$entry->createDirective('Name', 'go to pear.php.net');
$entry->createDirective('Icon', 'gnome-fs-bookmark');
$r = $conf->writeConfig(
'/home/cweiske/Desktop/pear.php.net.desktop',
'inicommented',
//windows newlines are not required in desktop files;
// they just serve as example how to use container options
array('linebreak' => "\r\n")
);
if (PEAR::isError($r)) {
echo $r->getMessage() . "\n";
}
?>
Generated file
[Desktop Entry] Version = 1.0 Type = Link URL = http://pear.php.net/ Name = go to pear.php.net Icon = gnome-fs-bookmark