clog.php

来自「用最近的dojo1.2.1制作前端的ajax购书网站」· PHP 代码 · 共 47 行

PHP
47
字号
<?php////	summary//		Creates/Opens files for logging data//		Useful for logging iinformation on a remote server//		when you don't have access to log files//		Also helpful for XHRs - since the page doesn't change//		to the PHP location which normally shows log data//		or errors.//// class cLOG {	var $logfile;	var $boolTimestamp;	function cLOG($filename, $boolTimestamp){		$this->boolTimestamp = $boolTimestamp;		$this->logfile = $filename;	}	function write($txt){		if($this->boolTimestamp){			$dt = date("y.m.d G.i.s");			$txt = "[". $dt ."]: ".$txt;		}		$fh = fopen($this->logfile, "a");		if(is_array($txt)){			//$txt = "::::::::".$txt;			$ar = $txt;			$txt = "Array:::::\n";			foreach($ar as $key => $value){				$txt += $key."=".$value."\n";			}		}		fwrite($fh, $txt."\n");		fclose($fh);	}	function clear(){		$fh = fopen($this->logfile, "w");		fwrite($fh, "");		fclose($fh);	}	function newline(){		$fh = fopen($this->logfile, "a");		fwrite($fh, "\n\n");		fclose($fh);	}}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?