php產生靜態頁面的方法(三個函數)

來源:互聯網
上載者:User
  1. /**

  2. 建立目錄
  3. */
  4. function makedir($mudir)
  5. {
  6. $file = "./$mudir";
  7. @mkdir($file,0777);
  8. }

  9. /**

  10. 先創子摸板檔案路徑
  11. */
  12. function writemod($filemodname)
  13. {
  14. $fp=fopen("showmod.shtml","r");
  15. $str=fread($fp,filesize("showmod.shtml"));
  16. fclose($fp);
  17. $fp=fopen($filemodname,"w");
  18. fwrite($fp,$str);
  19. fclose($fp);
  20. }

  21. /**

  22. 更新各自的子摸板檔案//$modfile是子摸板名字
  23. */
  24. function writeweb($content,$web,$modfile)
  25. {
  26. $fp=fopen($modfile,"r");
  27. $str=fread($fp,filesize($modfile));
  28. $str=str_replace($content,$web,$str);
  29. fclose($fp);
  30. $fp = fopen($modfile,"w");
  31. fwrite($fp,$str);
  32. fclose($fp);
  33. }
  34. $m = "00000";
  35. makedir($m);
  36. $ff = $m."/0001.shtml";
  37. if(!file_exists($ff))
  38. {
  39. writemod($ff);
  40. }
  41. else
  42. {
  43. echo"已經存在";
  44. }
  45. $d="{content6}"; //被更新的內容
  46. $dd="";//要更新的內容//要更新的內容
  47. @writeweb($d,$dd,$ff);
  48. ?>

複製代碼

您可能感興趣的文章:php產生靜態頁面的三種方法與代碼詳解php產生靜態頁面函數(php2html)的例子php產生html靜態頁面的方法參考php寫的一個產生靜態頁面的類將資料庫中的所有內容產生html靜態頁面的代碼虛擬機器主機上定時自動產生靜態頁面的方法php產生靜態頁面的詳細教程apache中訪問不了偽靜態頁面的解決方案php寫的關於靜態頁面的蜘蛛爬行記錄的代碼smarty產生靜態頁面的方法PHP產生靜態頁面的方法apache訪問不了偽靜態頁面的解決方案

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.