//日志记录 private function logger($log_content) { if (isset ( $_SERVER ['HTTP_APPNAME'] )) { //SAE sae_set_display_errors ( false ); sae_debug ( $log_content ); sae_set_display_errors ( true ); } else if ($_SERVER ['REMOTE_ADDR'] != "127.0.0.1") { //LOCAL $max_size = 1000000; $log_filename = "log.xml"; if (file_exists ( $log_filename ) and (abs ( filesize ( $log_filename ) ) > $max_size)) { unlink ( $log_filename ); } file_put_contents ( $log_filename, date ( 'Y-m-d H:i:s' ) . " " . $log_content . "\r\n", FILE_APPEND ); } }
使用
$postStr = $GLOBALS ["HTTP_RAW_POST_DATA"];$this->logger ( "R \r\n" . $postStr );