note 108384 added to function.parse-ini-file
| From: | JohannesSchmidt | Date: | Sat, 21 Apr 2012 19:11:44 +0000 |
| Subject: | note 108384 added to function.parse-ini-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187277@lists.php.net to get a copy of this message | ||
#If you want to replace a Setting in the ini, use this code:
/// bool SetCMSSettings(string $Setting, string $replace, string $INI_PATH)
/// $Setting = The Setting, which you want to replace
/// $replace = the new value
public function SetCMSSettings($Setting, $replace, $INI_PATH)
{
$ini = fopen($INI_PATH,"w+");
$i = 0;
while($Content = fgets($ini))
{
if(preg_match("/".$Setting."/", $Content)) {
fwrite($ini, $Setting."=".$replace);
$i = 1;
} else {
fwrite($ini, $Content);
}
}
// If, the setting wasnt replaced.
if($i == 0) {
fwrite($ini, $Setting."=".$replace);
}
fclose($ini);
}
----
Server IP: 85.214.154.209
Probable Submitter: 80.131.203.196
----
Manual Page -- http://www.php.net/manual/en/function.parse-ini-file.php
Edit -- https://master.php.net/note/edit/108384
Del: integrated -- https://master.php.net/note/delete/108384/integrated
Del: useless -- https://master.php.net/note/delete/108384/useless
Del: bad code -- https://master.php.net/note/delete/108384/bad+code
Del: spam -- https://master.php.net/note/delete/108384/spam
Del: non-english -- https://master.php.net/note/delete/108384/non-english
Del: in docs -- https://master.php.net/note/delete/108384/in+docs
Del: other reasons-- https://master.php.net/note/delete/108384
Reject -- https://master.php.net/note/reject/108384
Search -- https://master.php.net/manage/user-notes.php