公共方法(可以將其放到類庫裡邊):
1view code#region 記錄日誌
2#region 寫日誌
3///
4///
寫日誌5
///6
///日誌檔案路徑
7///
檔案分類
8///
記錄時間
9///
日誌內容
10public
static
void writelog(string filepath, string filename, datetime logtime, string
content)
1120
else
2124 sw.writeline(datetime.now.tostring() + "
" +content);
25sw.close();26}
27#endregion
2829
#region 建立日誌檔案路徑及檔名
30///
31///
建立日誌檔案路徑及檔名
32///
33///
檔案路徑
34///
記錄時間
35///
日誌完整路徑及檔名
36public
static
string createlogfilepath(string filepath, string
filename, datetime logtime)
3742
#endregion
43#endregion
呼叫示例:
1view codestring logdes="
這裡可以定義你要記錄日誌的內容";
2 writelog("
d:\\createorderid
", "
sys"
, datetime.now, logdes);3//
sys為記錄日誌的型別可以隨便定義
php建立簡單的文字日誌方法
建立文字日誌,傳送訂單資訊 public function sendlogs val,col url content start.content.end fwrite fp,content fclose fp 建立文字日誌,接收shop傳送的訂單資訊 public function receivel...
PHP寫文字日誌
寫檔案 param string file 檔案路徑 param string str 寫入內容 param char mode 寫入模式 function writefile file,str,mode w else 擴充套件應用,比如記錄每次請求的url內容 function writegetu...
練習 文字日誌增加刪除 指定字串格式
日誌格式 backend test.oldboy.orgb1 backend buy.oldboy.org import json s 顯示一級選單 def p 1 print 1 增加一條記錄 2 刪除一條記錄 顯示二級選單 def p 2 print 1 test.oldboy.org 2 bu...