Sunday, 9 July 2017

Create log file in php


Log file is more important for developer. It helps to find out bug or value checking for your site.

Process :
Step 1: Create log.php file and copy following code. Then run log.php file.

 <?php  
 $file = 'log.txt';  
 $log_value = 'This text will be save in log.txt file';  
 $current = file_get_contents($file);  // Open the file to get existing content  
 $current .= $log_value . "\n";      // Append a new person to the file  
 file_put_contents($file, $current);  // Write the contents back to the file  
 ?> 


















Step 2: Then check log.txt file






































1 comment:

How to create an visitor counter in PHP | hit counter

Total page view in the php. This count hit in the page. <?php session_start(); if(isset($_SESSION['page_view'])){...