<?php function savetofile($filename, $what) { { { error('Cannot Create File'); return false; } } { { { return true; } else { error('Cannot write '.$what.' into '.$filename); return false; } } else { error('Cannot create Handle for '.$filename); return false; } } else { error('File is not Writeable'); return false; } } function error($text) { if(DEBUGMODE) { EXIT; } } ?>
Sposób użycia:
<?php $text = 'options = 1; show=4'; savetofile('./plik.ini', $text); // lub gdy mamy wyłączony DEBUGMODE if(savetofile('./plik.ini', $text)) ... ?>
Pozdrawiam