Posted By

daisuke103 on 09/22/09


Tagged

php file textmate fopen


Versions (?)

PHP fopen() 外部ファイルに読み込んで保存


 / Published in: PHP
 

  1. require("tpl/" . $filename . ".php");
  2. $html = ob_get_contents();
  3. if($filename == "index"){
  4. $filename_r = $filename . ".xhtm"; //mb_ereg_replace("php", ".xhtm", $filename);
  5. $save = fopen("./site/" . $filename_r,"w+");
  6. }else{
  7. $filename_r = $filename . ".html"; //mb_ereg_replace("php", ".html", $filename);
  8. $save = fopen("./site/x/main/" . $filename_r,"w+");
  9. }
  10. flock($save,LOCK_EX);
  11. fwrite($save,$html);
  12. flock($save,LOCK_UN);
  13. fclose($save);
  14. //echo $html;
  15.  
  16. while (@ob_end_flush());

Report this snippet  

You need to login to post a comment.