<?php$connect=mysql_connect('localhost:3306','root','') or die('無法連線伺服器!');
$fn="temp.html";
$fp=fopen($fn,"r");
$tent=fread($fp,filesize($fn
));$select=mysql_select_db('chem',$connect);//
選擇資料庫
$sql="select * from article order by id desc";//
sql查詢語句
$query=mysql_query($sql,$connect
);
$num=mysql_num_rows($query
);
$psize=2;
$pcunt=ceil($num/$psize);//
總頁數for($i=0;$i
<$pcunt;$i++)
else
//echo $indexpath;
$start=$i*$psize
;
$file="";
$sqlstr="select * from article order by id desc limit $start,$psize";
$query=mysql_query($sqlstr,$connect
);
while($array=mysql_fetch_array($query
))
//echo $file; echo "
";$nume="";
for($j=1;$j
<=$pcunt;$j++)
else
}$content=str_replace("",$file,$tent
);
//$content=str_replace("",$title,$content);
$content=str_replace("",$nume,$content
);
//echo $content;
$filename="123/".$indexpath
;
if (is_file ($filename
))
$handle=fopen($filename,"w"); //
開啟檔案指標,建立檔案
/*檢查檔案是否被建立且可寫
*/if (!is_writable($filename
))
if (!fwrite ($handle,$content))
else
echo "生成檔案".$filename."成功
";
fclose ($handle); //
關閉指標
}fclose ($fp
);?>
aspx生成靜態htm頁
新建兩個類 1.freezablepage 它繼承自 system.web.ui.page。這個類用於重寫render方法,獲取頁面的htm輸出。2.myhtmlfilecreator 利用freezablepage輸出的htmltextwriter型物件,寫入新生成的htm靜態檔案。base.re...
使用HTTPCLIENT去生成靜態HTML頁面
一般生成html頁時,都會用比如freemarker等去搞,但今天看到和學到乙個還應該 不錯的方法,是使用httpclient的get方法,去讀某個動態的url,然後把讀出的內容再儲存成html的,下面例子介紹一下 public class htmlparser 根據模版及引數產生靜態頁面 publ...
linux使用apache發布靜態html網頁
環境 安裝1 檢查是否安裝和httpd 3 如果沒安裝 啟動httpd並驗證 接著在瀏覽器裡訪問linux主機的ip可以看到下面的頁面說明啟動成功 yum安裝的路徑一般在 etc httpd conf httpd.conf,自定義安裝的可以用find name httpd.conf找找。編輯配置檔案...