Skip to content

Instantly share code, notes, and snippets.

@VSeryoga
Created August 12, 2016 06:13
Show Gist options
  • Save VSeryoga/b580d90717258172f2bdb8ea766e9a17 to your computer and use it in GitHub Desktop.
Save VSeryoga/b580d90717258172f2bdb8ea766e9a17 to your computer and use it in GitHub Desktop.
Array to file
<?//Запись переменно в файл
function putFile($data, $append = FILE_APPEND, $file = 'temp_put.txt', $head = ''){
$str = Date('d.m.Y H:i:s').": ".$head." ---------------------------\n";
if($data){
if(is_array($data)){
$str .= print_r($data, 1);
}else{
$str .= $data."\n";
}
$str .= "END ---------------------------\n\n";
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/upload/logs/'.$file, $str, $append);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment