html静态页具体实现思路,带实例!!

       今天做项目用到php的静态化处理,甚是头疼。到底怎么能够简单的实现php的静态化处理呢,灵光一现想到了php的函数ob_start() 和 ob_get_content();

       下面是具体的思路,代码虽短但是代表的是一种思想!!

       程序行业,其它次之,思想第一!!!

       代码如下

  
  
  
  
  1. <?php 
  2. ob_start(); 
  3. ?> 
  4. <html> 
  5.   <head> 
  6.         <title>this is a  html example!!!</title> 
  7.   </head> 
  8.   <body> 
  9.     this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!!this is a  html example!!! 
  10.   </body> 
  11. </html> 
  12.  
  13. <?php  
  14. $html = ob_get_contents(); 
  15.  
  16. $fp = fopen('./htm.html',"w"); 
  17.  
  18. fwrite($fp,$html); 
  19.  
  20. fclose($fp); 
  21. ?> 
  22.  
  23. 放到你的www目录下尝试下吧!!这就是简单的html实现思路!! 

 

你可能感兴趣的:(职场,休闲,php静态化的实现思路)