C json陣列生成靜態HTML

2021-06-26 11:18:03 字數 533 閱讀 1620

如果返回的json陣列為list
return json(list);
返回到頁面中,list內容為:
[,,,]
我們可以在固定目錄下生成乙個html靜態檔案儲存輸出的list內容:
streamwriter sw = new streamwriter(f,encoding.getencoding("gb2312"));

//如果直接寫上面這段**生成的文字會出現亂碼

sw.writeline("");

foreach (novel novel in list)

sw.writeline("");

sw.close();

return json(list);

這樣,在輸出list內容的同時在html資料夾下也會同時生成json這個html檔案

生成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...

PHP生成靜態html

一 建立muban.html檔案,新增如下 內容 二 建立php檔案,新增如下 header content type text html charset utf 8 將資料存入二維陣列 con array array 文章標題1 文章內容1 array 文章標題2 文章內容2 array 文章標題...