Thursday, June 2, 2011

Generate Logs in php

class logfile{
    function write($the_string )
    {
        if( $fh = @fopen( "storeLog.txt", "a+" ) )
        {
            fputs( $fh, $the_string, strlen($the_string) );
            fclose( $fh );
            return( true );
        }
        else
        {
            return( false );
        }
    }
}


$lf = new logfile();
$lf->write("Log starts here");
echo "Log data";
$lf->write("End First Log");
?>