Search
 
SCRIPT & CODE EXAMPLE
 

PHP

log data into file php

//Something to write to txt log
$log  = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
        "Attempt: ".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL.
        "User: ".$username.PHP_EOL.
        "-------------------------".PHP_EOL;
//Save string to log, use FILE_APPEND to append.
file_put_contents('./log_'.date("j.n.Y").'.log', $log, FILE_APPEND);
Comment

PREVIOUS NEXT
Code Example
Php :: integer nullable laravel 
Php :: adding column to array php 
Php :: how to add newline in php 
Php :: php date fomat 
Php :: check string php 
Php :: Remove all attributes from HTML tags in PHP 
Php :: php nan 
Php :: htmlspecialchars() expects parameter 1 to be string 
Php :: flutter form autadjust height 
Php :: Notice: Undefined property: enable_for_virtual 
Php :: laravel get url without domain in blade 
Php :: php current date 
Php :: file_put_contents php json file 
Php :: case statement in php 
Php :: time duration calculation laravel 
Php :: codeigniter 4 redirect to home 
Php :: phpunit repeat 
Php :: check if date is past php 
Php :: php check string size 
Php :: php check for empty string 
Php :: check file size validation laravel 
Php :: php carbon from timestamp 
Php :: if browser url is having domain in it check using php 
Php :: lumen generate app key 
Php :: php convert minutes to hours and minutes 
Php :: laravel 8 date format 
Php :: laravel storage get file path 
Php :: php in javascript 
Php :: save post data to file php 
Php :: wordpress check if class exists 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =