建立靜態頁面的方法示例一 1

2021-04-13 05:02:29 字數 1728 閱讀 4933

該類提供了建立靜態頁面的基本方法,相當於底層statichtml類方便應用類的呼叫:

using system;

using system.io;

using system.text;

using system.web;

using system.web.sessionstate;

using system.web.ui;

using system.web.ui.webcontrols;

using system.web.ui.htmlcontrols;

using system.collections;

using system.componentmodel;

using system.data;

namespace jobslib

///

/// 建構函式

///

/// 源檔名

/// 目的檔案路徑

/// 目的檔名稱

/*public statichtml(string s_filename,string path,string t_filename)

*////

/// 建構函式

///

/// 網頁內容

/// 路徑

/// 目標檔名

public statichtml(string s_content,string path,string t_filename)

///

/// 過載的建構函式

///

///

///

public statichtml(string s_filename,string t_pathfile)

///

/// 寫入靜態頁面

///

///

public system.boolean writetofile()

}*/ 

streamwriter ts=null;    

encoding code = encoding.getencoding("gb2312");

ts = new streamwriter(targe_pathfile,false,code);

ts.write(content);

ts.close();

return true;

}catch(exception exc)

}///

/// 得到目標檔案的流

///

///

private stream getfilestream()

catch

}else

}///

/// 實現流的拷貝

///

///

///

private void streamtostream (stream src, stream dst)

}///

///

///

///

private system.boolean getstatichtml()

else

}///

/// 公共方法,判斷是否存在靜態頁面

///

///

public system.boolean htmlfileexist()

return true;

}else}}

}

建立靜態頁面的方法示例一 2

該類屬於應用類,主要提供窗體頁面呼叫建立靜態頁面的方法 using system using system.io using system.web.ui using system.web.ui.webcontrols namespace jobslib 建構函式,源檔名,不帶任何引數 目標檔名 pu...

生成靜態頁面的方法

對於 特別是cms系統中,生成靜態頁面是必不可少的,靜態頁面不用去和資料庫打交道,可以提高頁面的訪問速度。生成靜態頁面的方法一般有 兩種,一種是以模板的形式生成,第二種是直接根據url來生成靜態頁面。以模板形式生成的原理就是字串替換,在.net中已經提供了乙個字串替換的函式 replace 用模板生...

PHP生成靜態頁面的方法

雖然 方法 很多,但使用起來簡便容易的,我覺得還是先判斷已經生成的首頁檔案的生成時間和現有時間之間的差值,如果滿足某個值就開始生成,這種方法比較來得容易,不多說了,開始吧!在開始之前還是提一下三個函式吧 ob start ob end clean ob get contents ob start 是...