write_ini_file
function write_ini_file($path, $assoc_array) {
foreach ($assoc_array as $key => $item) {
if (is_array($item)) {
$content .= "\n[$key]\n";
foreach ($item as $key2 => $item2) {
$content .= "$key2 = \"$item2\"\n";
}
} else {
$content .= "$key = \"$item\"\n";
}
}
if (!$handle = fopen($path, 'w')) {
return false;
}
if (!fwrite($handle, $content)) {
return false;
}
fclose($handle);
return true;
}
No comments:
Post a Comment