使用模板生成HTML頁

2021-05-02 12:07:38 字數 754 閱讀 7571

public

static

bool

writefile(

string

strtext,

string

strcontent,

string

strauthor)

catch

(exception exp)

string

htmlfilename

=datetime.now.tostring(

"yyyymmddhhmmss")

+".html";

//替換內容

//這時,模板檔案已經讀入到名稱為str的變數中了

str

=str.replace(

"showarticle

", strtext);

//模板頁中的showarticle

str

=str.replace(

"biaoti

", strtext);

str

=str.replace(

"content

", strcontent);

str

=str.replace(

"author

", strauthor);

//寫檔案

trycatch

(exception ex)

finally

return

true;}

生成html靜態頁

方案1 傳入url返回網頁的html url public static string geturltohtml string url get the response stream.system.io.stream respstream wresp.getresponsestream dim re...

生成html靜態頁

方案1 傳入url返回網頁的html url public static string geturltohtml string url get the response stream.system.io.stream respstream wresp.getresponsestream dim re...

生成html靜態頁

方案1 傳入url返回網頁的html url public static string geturltohtml string url get the response stream.system.io.stream respstream wresp.getresponsestream dim re...