Created
August 12, 2016 06:13
-
-
Save VSeryoga/b580d90717258172f2bdb8ea766e9a17 to your computer and use it in GitHub Desktop.
Array to file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?//Запись переменно в файл | |
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