Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to create a logfile in php?

<?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 :: laravel sort collection 
Php :: wordpress get site title 
Php :: how to use javascript variable in php 
Php :: php get text from html 
Php :: php date format iso 
Php :: php closecursor 
Php :: image uploading and validation php 
Php :: search on taxonomy wordpress query 
Php :: increase memory laravel controller 
Php :: php decode json file 
Php :: assign php array into javascript 
Php :: php unset array element 
Php :: wordpress check if class exists 
Php :: php number to color 
Php :: get html file data to variable in php 
Php :: php json encode 
Php :: php append to csv 
Php :: php exercises 
Php :: upload file in laravel 
Php :: how to use wherein in json array laravel 
Php :: twig filter line break 
Php :: wp logs 
Php :: how to get data from html form in php 
Php :: get words after string in in php 
Php :: how to change existing migration laravel 
Php :: wordpress featured image show 
Php :: How to Manually Upgrade phpMyAdmin on Ubuntu 
Php :: laravel multiple where conditions 
Php :: the posts pagination 
Php :: how to convert array to string in php 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =